From 79dd17c7472e6a26b96191bb984f076eed68aa62 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sat, 3 Sep 2011 22:42:07 +0900 Subject: [PATCH] =?UTF-8?q?is=5Fsub=5Farray=20=E6=9B=B4=E6=96=B0=20is=5Far?= =?UTF-8?q?ray,=20is=5Fbasic=5Fstring=20=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sprout/array.hpp | 30 +++++++++++ sprout/string.hpp | 125 ++++++++++++++++++++++++++++++++++++++++++- sprout/sub_array.hpp | 44 ++++++++------- 3 files changed, 179 insertions(+), 20 deletions(-) diff --git a/sprout/array.hpp b/sprout/array.hpp index b5e43d00..60b06f0b 100644 --- a/sprout/array.hpp +++ b/sprout/array.hpp @@ -187,6 +187,36 @@ namespace sprout { }; }; + namespace detail { + template + struct is_array_impl { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + template + struct is_array_impl< + T, + typename std::enable_if< + std::is_same< + T, + sprout::array + >::value + >::type + > { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + } // namespace detail + // + // is_array + // + template + struct is_array + : public sprout::detail::is_array_impl + {}; + // // make_array // diff --git a/sprout/string.hpp b/sprout/string.hpp index 090623ec..5f357732 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -195,6 +195,87 @@ namespace sprout { }; }; + namespace detail { + template + struct is_basic_string_impl { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + template + struct is_basic_string_impl< + T, + typename std::enable_if< + std::is_same< + T, + sprout::basic_string + >::value + >::type + > { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + } // namespace detail + // + // is_basic_string + // + template + struct is_basic_string + : public sprout::detail::is_basic_string_impl + {}; + + namespace detail { + template + struct is_string_impl { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + template + struct is_string_impl< + T, + typename std::enable_if< + std::is_same< + T, + sprout::basic_string + >::value + >::type + > { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + } // namespace detail + // + // is_string + // + template + struct is_string + : public sprout::detail::is_string_impl + {}; + // + // is_wstring + // + template + struct is_wstring + : public sprout::detail::is_string_impl + {}; + // + // is_u16string + // + template + struct is_u16string + : public sprout::detail::is_string_impl + {}; + // + // is_u32string + // + template + struct is_u32string + : public sprout::detail::is_string_impl + {}; + namespace detail { template SPROUT_CONSTEXPR inline sprout::basic_string to_string_impl( @@ -265,13 +346,55 @@ namespace sprout { // template using string = sprout::basic_string; - // // wstring // template using wstring = sprout::basic_string; + // + // u16string + // + template + using u16string = sprout::basic_string; + // + // u32string + // + template + using u32string = sprout::basic_string; #endif // #if 0 + + // + // string_t + // + template + struct string_t { + public: + typedef sprout::basic_string type; + }; + // + // wstring_t + // + template + struct wstring_t { + public: + typedef sprout::basic_string type; + }; + // + // u16string_t + // + template + struct u16string_t { + public: + typedef sprout::basic_string type; + }; + // + // u32string_t + // + template + struct u32string_t { + public: + typedef sprout::basic_string type; + }; } // namespace sprout namespace std { diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index 65560ea0..8bf5c63a 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -544,29 +544,35 @@ namespace sprout { } }; + namespace detail { + template + struct is_sub_array_impl { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + template + struct is_sub_array_impl< + T, + typename std::enable_if< + std::is_same< + T, + sprout::sub_array + >::value + >::type + > { + public: + typedef std::integral_constant type; + SPROUT_STATIC_CONSTEXPR bool value = type::value; + }; + } // namespace detail // // is_sub_array // - template - struct is_sub_array { - public: - typedef std::integral_constant type; - SPROUT_STATIC_CONSTEXPR bool value = type::value; - }; template - struct is_sub_array< - T, - typename std::enable_if< - std::is_same< - T, - sprout::sub_array - >::value - >::type - > { - public: - typedef std::integral_constant type; - SPROUT_STATIC_CONSTEXPR bool value = type::value; - }; + struct is_sub_array + : public sprout::detail::is_sub_array_impl + {}; // // sub