add make_array_without_narrowing

This commit is contained in:
bolero-MURAKAMI 2014-04-15 13:37:38 +09:00
parent 36fe036f38
commit 6a6fdd41ec

View file

@ -33,11 +33,25 @@ namespace sprout {
template<sprout::detail::make_array_t = sprout::detail::make_array_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::array<typename sprout::common_decay<Types...>::type, sizeof...(Types)>
make_array(Types&&... args) {
typedef sprout::array<
typename sprout::common_decay<Types...>::type,
sizeof...(Types)
> type;
return type{{typename sprout::common_decay<Types...>::type(SPROUT_FORWARD(Types, args))...}};
typedef typename sprout::common_decay<Types...>::type value_type;
typedef sprout::array<value_type, sizeof...(Types)> type;
return type{{value_type(SPROUT_FORWARD(Types, args))...}};
}
//
// make_array_without_narrowing
//
template<typename T, typename... Types>
inline SPROUT_CONSTEXPR sprout::array<typename std::remove_cv<T>::type, sizeof...(Types)>
make_array_without_narrowing(Types&&... args) {
return sprout::array<typename std::remove_cv<T>::type, sizeof...(Types)>{{SPROUT_FORWARD(Types, args)...}};
}
template<sprout::detail::make_array_t = sprout::detail::make_array_in_common_elements, typename... Types>
inline SPROUT_CONSTEXPR sprout::array<typename sprout::common_decay<Types...>::type, sizeof...(Types)>
make_array_without_narrowing(Types&&... args) {
typedef typename sprout::common_decay<Types...>::type value_type;
typedef sprout::array<value_type, sizeof...(Types)> type;
return type{{SPROUT_FORWARD(Types, args)...}};
}
//