add make_array, make_string variation (remove make_string_as)

This commit is contained in:
bolero-MURAKAMI 2016-04-03 21:00:55 +09:00
parent f0ec89c423
commit 478c21a300
5 changed files with 108 additions and 22 deletions

View file

@ -32,6 +32,13 @@ namespace sprout {
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(T(SPROUT_FORWARD(Types, args))...);
}
template<typename T, std::size_t N, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename std::remove_cv<T>::type, N>
make_valarray(Types&&... args) {
typedef sprout::valarray<typename std::remove_cv<T>::type, N> type;
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(T(SPROUT_FORWARD(Types, args))...);
}
template<sprout::detail::make_valarray_t = sprout::detail::make_valarray_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename sprout::common_decay<Types...>::type, sizeof...(Types)>
make_valarray(Types&&... args) {
@ -40,6 +47,14 @@ namespace sprout {
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(value_type(SPROUT_FORWARD(Types, args))...);
}
template<std::size_t N, sprout::detail::make_valarray_t = sprout::detail::make_valarray_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename sprout::common_decay<Types...>::type, N>
make_valarray(Types&&... args) {
typedef typename sprout::common_decay<Types...>::type value_type;
typedef sprout::valarray<value_type, N> type;
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(value_type(SPROUT_FORWARD(Types, args))...);
}
//
// make_valarray_without_narrowing
@ -51,6 +66,13 @@ namespace sprout {
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(SPROUT_FORWARD(Types, args)...);
}
template<typename T, std::size_t N, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename std::remove_cv<T>::type, N>
make_valarray_without_narrowing(Types&&... args) {
typedef sprout::valarray<typename std::remove_cv<T>::type, N> type;
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(SPROUT_FORWARD(Types, args)...);
}
template<sprout::detail::make_valarray_t = sprout::detail::make_valarray_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename sprout::common_decay<Types...>::type, sizeof...(Types)>
make_valarray_without_narrowing(Types&&... args) {
@ -59,6 +81,14 @@ namespace sprout {
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(SPROUT_FORWARD(Types, args)...);
}
template<std::size_t N, sprout::detail::make_valarray_t = sprout::detail::make_valarray_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename sprout::common_decay<Types...>::type, N>
make_valarray_without_narrowing(Types&&... args) {
typedef typename sprout::common_decay<Types...>::type value_type;
typedef sprout::valarray<value_type, N> type;
typedef sprout::detail::make_construct_impl<type> construct_type;
return construct_type::make(SPROUT_FORWARD(Types, args)...);
}
//
// make_common_valarray
@ -68,6 +98,11 @@ namespace sprout {
make_common_valarray(Types&&... args) {
return sprout::make_valarray(SPROUT_FORWARD(Types, args)...);
}
template<std::size_t N, typename... Types>
inline SPROUT_CONSTEXPR sprout::valarray<typename sprout::common_decay<Types...>::type, N>
make_common_valarray(Types&&... args) {
return sprout::make_valarray<N>(SPROUT_FORWARD(Types, args)...);
}
} // namespace sprout
#endif // #ifndef SPROUT_VALARRAY_MAKE_VALARRAY_HPP