mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add template aliases type_traits
This commit is contained in:
parent
e3e130f58d
commit
f5b8b91255
10 changed files with 44 additions and 4 deletions
|
@ -24,12 +24,12 @@ namespace sprout {
|
|||
//
|
||||
template<typename... Types>
|
||||
inline SPROUT_CONSTEXPR sprout::array<
|
||||
typename sprout::common_decay<typename std::decay<Types>::type...>::type,
|
||||
typename sprout::common_decay<Types&&...>::type,
|
||||
sizeof...(Types)
|
||||
>
|
||||
make_common_array(Types&&... args) {
|
||||
typedef sprout::array<
|
||||
typename sprout::common_decay<typename std::decay<Types>::type...>::type,
|
||||
typename sprout::common_decay<Types&&...>::type,
|
||||
sizeof...(Types)
|
||||
> type;
|
||||
return type{{sprout::forward<Types>(args)...}};
|
||||
|
|
|
@ -108,10 +108,10 @@ namespace sprout {
|
|||
)
|
||||
,
|
||||
T,
|
||||
typename sprout::common_decay<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
typename sprout::common_decay<T, U>::type
|
||||
>::type
|
||||
>::type,
|
||||
typename sprout::common_decay<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
typename sprout::common_decay<T, U>::type
|
||||
>
|
||||
{};
|
||||
template<typename T, typename U, typename... Tail>
|
||||
|
|
|
@ -52,6 +52,11 @@ namespace sprout {
|
|||
typename std::remove_cv<Types>::type...
|
||||
>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename... Types>
|
||||
using arithmetic_promote_ = typename sprout::arithmetic_promote<Types...>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_ARITHMETIC_PROMOTE_HPP
|
||||
|
|
|
@ -12,6 +12,11 @@ namespace sprout {
|
|||
struct common_decay
|
||||
: public std::decay<typename std::common_type<Types...>::type>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename... Types>
|
||||
using common_decay_ = typename sprout::common_decay<Types...>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_COMMON_DECAY_HPP
|
||||
|
|
|
@ -63,6 +63,11 @@ namespace sprout {
|
|||
typename std::remove_cv<Types>::type...
|
||||
>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename... Types>
|
||||
using float_promote_ = typename sprout::float_promote<Types...>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_FLOAT_PROMOTE_HPP
|
||||
|
|
|
@ -12,6 +12,11 @@ namespace sprout {
|
|||
public:
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename T>
|
||||
using identity_ = typename sprout::identity<T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_IDENTITY_HPP
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace sprout {
|
|||
struct is_c_str<char32_t const[N]>
|
||||
: public std::true_type
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename T>
|
||||
using is_c_str_ = typename sprout::is_c_str<T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_IS_C_STR_HPP
|
||||
|
|
|
@ -40,6 +40,11 @@ namespace sprout {
|
|||
struct is_char_type<char32_t>
|
||||
: public std::true_type
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename T>
|
||||
using is_char_type_ = typename sprout::is_char_type<T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_IS_CHAR_TYPE_HPP
|
||||
|
|
|
@ -15,6 +15,11 @@ namespace sprout {
|
|||
std::is_integral<T>::value && std::is_signed<T>::value
|
||||
>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename T>
|
||||
using is_int_ = typename sprout::is_int<T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_IS_INT_HPP
|
||||
|
|
|
@ -15,6 +15,11 @@ namespace sprout {
|
|||
std::is_integral<T>::value && std::is_unsigned<T>::value
|
||||
>
|
||||
{};
|
||||
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<typename T>
|
||||
using is_uint_ = typename sprout::is_uint<T>::type;
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TYPE_TRAITS_IS_UINT_HPP
|
||||
|
|
Loading…
Reference in a new issue