2012-06-22 10:14:21 +00:00
|
|
|
#ifndef SPROUT_ARRAY_MAKE_ARRAY_HPP
|
|
|
|
#define SPROUT_ARRAY_MAKE_ARRAY_HPP
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/config.hpp>
|
2013-04-06 04:06:51 +00:00
|
|
|
#include <sprout/index_tuple/metafunction.hpp>
|
2012-06-22 10:14:21 +00:00
|
|
|
#include <sprout/array/array.hpp>
|
|
|
|
#include <sprout/utility/forward.hpp>
|
2013-03-21 13:11:40 +00:00
|
|
|
#include <sprout/type_traits/common_decay.hpp>
|
2012-06-22 10:14:21 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// make_array
|
|
|
|
//
|
|
|
|
template<typename T, typename... Types>
|
2012-10-04 16:53:39 +00:00
|
|
|
inline SPROUT_CONSTEXPR sprout::array<T, sizeof...(Types)>
|
|
|
|
make_array(Types&&... args) {
|
2012-06-22 10:14:21 +00:00
|
|
|
return sprout::array<T, sizeof...(Types)>{{sprout::forward<Types>(args)...}};
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// make_common_array
|
|
|
|
//
|
|
|
|
template<typename... Types>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::array<
|
2013-03-23 14:46:03 +00:00
|
|
|
typename sprout::common_decay<Types&&...>::type,
|
2012-06-22 10:14:21 +00:00
|
|
|
sizeof...(Types)
|
2012-10-04 16:53:39 +00:00
|
|
|
>
|
|
|
|
make_common_array(Types&&... args) {
|
|
|
|
typedef sprout::array<
|
2013-03-23 14:46:03 +00:00
|
|
|
typename sprout::common_decay<Types&&...>::type,
|
2012-06-22 10:14:21 +00:00
|
|
|
sizeof...(Types)
|
2012-10-04 16:53:39 +00:00
|
|
|
> type;
|
|
|
|
return type{{sprout::forward<Types>(args)...}};
|
2012-06-22 10:14:21 +00:00
|
|
|
}
|
2013-08-03 11:03:13 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// convert_array
|
|
|
|
//
|
|
|
|
template<typename T, typename Converter, typename... Types>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::array<T, sizeof...(Types)>
|
|
|
|
convert_array(Converter&& conv, Types&&... args) {
|
|
|
|
return sprout::make_array<T>(sprout::forward<Converter>(conv)(sprout::forward<Types>(args))...);
|
|
|
|
}
|
2012-06-22 10:14:21 +00:00
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_ARRAY_MAKE_ARRAY_HPP
|