mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-02-04 21:33:56 +00:00
is_sub_array 更新
is_array, is_basic_string 追加
This commit is contained in:
parent
fd1cfd05af
commit
79dd17c747
3 changed files with 179 additions and 20 deletions
|
@ -187,6 +187,36 @@ namespace sprout {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template<typename T, typename Enable = void>
|
||||||
|
struct is_array_impl {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, false> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct is_array_impl<
|
||||||
|
T,
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_same<
|
||||||
|
T,
|
||||||
|
sprout::array<typename T::value_type, T::static_size>
|
||||||
|
>::value
|
||||||
|
>::type
|
||||||
|
> {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, true> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
//
|
||||||
|
// is_array
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_array
|
||||||
|
: public sprout::detail::is_array_impl<T>
|
||||||
|
{};
|
||||||
|
|
||||||
//
|
//
|
||||||
// make_array
|
// make_array
|
||||||
//
|
//
|
||||||
|
|
|
@ -195,6 +195,87 @@ namespace sprout {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template<typename T, typename Enable = void>
|
||||||
|
struct is_basic_string_impl {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, false> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct is_basic_string_impl<
|
||||||
|
T,
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_same<
|
||||||
|
T,
|
||||||
|
sprout::basic_string<typename T::value_type, T::static_size>
|
||||||
|
>::value
|
||||||
|
>::type
|
||||||
|
> {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, true> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
//
|
||||||
|
// is_basic_string
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_basic_string
|
||||||
|
: public sprout::detail::is_basic_string_impl<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template<typename T, typename Elem, typename Enable = void>
|
||||||
|
struct is_string_impl {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, false> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
template<typename T, typename Elem>
|
||||||
|
struct is_string_impl<
|
||||||
|
T,
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_same<
|
||||||
|
T,
|
||||||
|
sprout::basic_string<Elem, T::static_size>
|
||||||
|
>::value
|
||||||
|
>::type
|
||||||
|
> {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, true> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
//
|
||||||
|
// is_string
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_string
|
||||||
|
: public sprout::detail::is_string_impl<T, char>
|
||||||
|
{};
|
||||||
|
//
|
||||||
|
// is_wstring
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_wstring
|
||||||
|
: public sprout::detail::is_string_impl<T, wchar_t>
|
||||||
|
{};
|
||||||
|
//
|
||||||
|
// is_u16string
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_u16string
|
||||||
|
: public sprout::detail::is_string_impl<T, char16_t>
|
||||||
|
{};
|
||||||
|
//
|
||||||
|
// is_u32string
|
||||||
|
//
|
||||||
|
template<typename T>
|
||||||
|
struct is_u32string
|
||||||
|
: public sprout::detail::is_string_impl<T, char32_t>
|
||||||
|
{};
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T, std::size_t N, std::ptrdiff_t...Indexes>
|
template<typename T, std::size_t N, std::ptrdiff_t...Indexes>
|
||||||
SPROUT_CONSTEXPR inline sprout::basic_string<T, N - 1> to_string_impl(
|
SPROUT_CONSTEXPR inline sprout::basic_string<T, N - 1> to_string_impl(
|
||||||
|
@ -265,13 +346,55 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
using string = sprout::basic_string<char, N>;
|
using string = sprout::basic_string<char, N>;
|
||||||
|
|
||||||
//
|
//
|
||||||
// wstring
|
// wstring
|
||||||
//
|
//
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
using wstring = sprout::basic_string<wchar_t, N>;
|
using wstring = sprout::basic_string<wchar_t, N>;
|
||||||
|
//
|
||||||
|
// u16string
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
using u16string = sprout::basic_string<char16_t, N>;
|
||||||
|
//
|
||||||
|
// u32string
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
using u32string = sprout::basic_string<char32_t, N>;
|
||||||
#endif // #if 0
|
#endif // #if 0
|
||||||
|
|
||||||
|
//
|
||||||
|
// string_t
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
struct string_t {
|
||||||
|
public:
|
||||||
|
typedef sprout::basic_string<char, N> type;
|
||||||
|
};
|
||||||
|
//
|
||||||
|
// wstring_t
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
struct wstring_t {
|
||||||
|
public:
|
||||||
|
typedef sprout::basic_string<wchar_t, N> type;
|
||||||
|
};
|
||||||
|
//
|
||||||
|
// u16string_t
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
struct u16string_t {
|
||||||
|
public:
|
||||||
|
typedef sprout::basic_string<char16_t, N> type;
|
||||||
|
};
|
||||||
|
//
|
||||||
|
// u32string_t
|
||||||
|
//
|
||||||
|
template<std::size_t N>
|
||||||
|
struct u32string_t {
|
||||||
|
public:
|
||||||
|
typedef sprout::basic_string<char32_t, N> type;
|
||||||
|
};
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
|
@ -544,29 +544,35 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template<typename T, typename Enable = void>
|
||||||
|
struct is_sub_array_impl {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, false> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct is_sub_array_impl<
|
||||||
|
T,
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_same<
|
||||||
|
T,
|
||||||
|
sprout::sub_array<typename T::container_type>
|
||||||
|
>::value
|
||||||
|
>::type
|
||||||
|
> {
|
||||||
|
public:
|
||||||
|
typedef std::integral_constant<bool, true> type;
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
//
|
//
|
||||||
// is_sub_array
|
// is_sub_array
|
||||||
//
|
//
|
||||||
template<typename T, typename Enable = void>
|
|
||||||
struct is_sub_array {
|
|
||||||
public:
|
|
||||||
typedef std::integral_constant<bool, false> type;
|
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_sub_array<
|
struct is_sub_array
|
||||||
T,
|
: public sprout::detail::is_sub_array_impl<T>
|
||||||
typename std::enable_if<
|
{};
|
||||||
std::is_same<
|
|
||||||
T,
|
|
||||||
sprout::sub_array<typename T::container_type>
|
|
||||||
>::value
|
|
||||||
>::type
|
|
||||||
> {
|
|
||||||
public:
|
|
||||||
typedef std::integral_constant<bool, true> type;
|
|
||||||
SPROUT_STATIC_CONSTEXPR bool value = type::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// sub
|
// sub
|
||||||
|
|
Loading…
Add table
Reference in a new issue