/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_VALARRAY_MAKE_VALARRAY_HPP #define SPROUT_VALARRAY_MAKE_VALARRAY_HPP #include #include #include #include #include #include #include namespace sprout { namespace detail { enum make_valarray_t { make_valarray_in_common_elements }; } // namespace detail // // make_valarray // template inline SPROUT_CONSTEXPR sprout::valarray::type, sizeof...(Types)> make_valarray(Types&&... args) { typedef sprout::valarray::type, sizeof...(Types)> type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(T(SPROUT_FORWARD(Types, args))...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, N> make_valarray(Types&&... args) { typedef sprout::valarray::type, N> type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(T(SPROUT_FORWARD(Types, args))...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, sizeof...(Types)> make_valarray(Types&&... args) { typedef typename sprout::common_decay::type value_type; typedef sprout::valarray type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(value_type(SPROUT_FORWARD(Types, args))...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, N> make_valarray(Types&&... args) { typedef typename sprout::common_decay::type value_type; typedef sprout::valarray type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(value_type(SPROUT_FORWARD(Types, args))...); } // // make_valarray_without_narrowing // template inline SPROUT_CONSTEXPR sprout::valarray::type, sizeof...(Types)> make_valarray_without_narrowing(Types&&... args) { typedef sprout::valarray::type, sizeof...(Types)> type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(SPROUT_FORWARD(Types, args)...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, N> make_valarray_without_narrowing(Types&&... args) { typedef sprout::valarray::type, N> type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(SPROUT_FORWARD(Types, args)...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, sizeof...(Types)> make_valarray_without_narrowing(Types&&... args) { typedef typename sprout::common_decay::type value_type; typedef sprout::valarray type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(SPROUT_FORWARD(Types, args)...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, N> make_valarray_without_narrowing(Types&&... args) { typedef typename sprout::common_decay::type value_type; typedef sprout::valarray type; typedef sprout::detail::make_construct_impl construct_type; return construct_type::make(SPROUT_FORWARD(Types, args)...); } // // make_common_valarray // template inline SPROUT_CONSTEXPR sprout::valarray::type, sizeof...(Types)> make_common_valarray(Types&&... args) { return sprout::make_valarray(SPROUT_FORWARD(Types, args)...); } template inline SPROUT_CONSTEXPR sprout::valarray::type, N> make_common_valarray(Types&&... args) { return sprout::make_valarray(SPROUT_FORWARD(Types, args)...); } } // namespace sprout #endif // #ifndef SPROUT_VALARRAY_MAKE_VALARRAY_HPP