diff --git a/sprout/array/make_array.hpp b/sprout/array/make_array.hpp index a7b27f0c..95aa955b 100644 --- a/sprout/array/make_array.hpp +++ b/sprout/array/make_array.hpp @@ -30,6 +30,11 @@ namespace sprout { make_array(Types&&... args) { return sprout::array::type, sizeof...(Types)>{{T(SPROUT_FORWARD(Types, args))...}}; } + template + inline SPROUT_CONSTEXPR sprout::array::type, N> + make_array(Types&&... args) { + return sprout::array::type, N>{{T(SPROUT_FORWARD(Types, args))...}}; + } template inline SPROUT_CONSTEXPR sprout::array::type, sizeof...(Types)> make_array(Types&&... args) { @@ -37,6 +42,13 @@ namespace sprout { typedef sprout::array type; return type{{value_type(SPROUT_FORWARD(Types, args))...}}; } + template + inline SPROUT_CONSTEXPR sprout::array::type, N> + make_array(Types&&... args) { + typedef typename sprout::common_decay::type value_type; + typedef sprout::array type; + return type{{value_type(SPROUT_FORWARD(Types, args))...}}; + } // // make_array_without_narrowing @@ -46,6 +58,11 @@ namespace sprout { make_array_without_narrowing(Types&&... args) { return sprout::array::type, sizeof...(Types)>{{SPROUT_FORWARD(Types, args)...}}; } + template + inline SPROUT_CONSTEXPR sprout::array::type, N> + make_array_without_narrowing(Types&&... args) { + return sprout::array::type, N>{{SPROUT_FORWARD(Types, args)...}}; + } template inline SPROUT_CONSTEXPR sprout::array::type, sizeof...(Types)> make_array_without_narrowing(Types&&... args) { @@ -53,6 +70,13 @@ namespace sprout { typedef sprout::array type; return type{{SPROUT_FORWARD(Types, args)...}}; } + template + inline SPROUT_CONSTEXPR sprout::array::type, N> + make_array_without_narrowing(Types&&... args) { + typedef typename sprout::common_decay::type value_type; + typedef sprout::array type; + return type{{SPROUT_FORWARD(Types, args)...}}; + } // // make_common_array @@ -62,6 +86,11 @@ namespace sprout { make_common_array(Types&&... args) { return sprout::make_array(SPROUT_FORWARD(Types, args)...); } + template + inline SPROUT_CONSTEXPR sprout::array::type, N> + make_common_array(Types&&... args) { + return sprout::make_array(SPROUT_FORWARD(Types, args)...); + } // // convert_array diff --git a/sprout/string/make_string.hpp b/sprout/string/make_string.hpp index 417a8da6..7d94ad70 100644 --- a/sprout/string/make_string.hpp +++ b/sprout/string/make_string.hpp @@ -16,33 +16,55 @@ #include namespace sprout { + namespace detail { + enum make_string_t { + make_string_in_head_type + }; + } // namespace detail // // make_string // - template - inline SPROUT_CONSTEXPR sprout::basic_string::type, 1 + sizeof...(Types)> - make_string(T&& t, Types&&... args) { - typedef sprout::detail::make_construct_impl< - sprout::basic_string::type, 1 + sizeof...(Types)> - > impl_type; - return impl_type::make(SPROUT_FORWARD(T, t), SPROUT_FORWARD(Types, args)...); - } - - // - // make_string_as - // template inline SPROUT_CONSTEXPR sprout::basic_string::type, 0> - make_string_as() { + make_string() { return sprout::basic_string::type, 0>(); } - template - inline SPROUT_CONSTEXPR sprout::basic_string::type, sizeof...(Types)> - make_string_as(Types&&... args) { + template + inline SPROUT_CONSTEXPR sprout::basic_string::type, N> + make_string() { + return sprout::basic_string::type, N>(); + } + template + inline SPROUT_CONSTEXPR sprout::basic_string::type, 1 + sizeof...(Tail)> + make_string(Head&& head, Tail&&... tail) { typedef sprout::detail::make_construct_impl< - sprout::basic_string::type, sizeof...(Types)> + sprout::basic_string::type, 1 + sizeof...(Tail)> > impl_type; - return impl_type::make(SPROUT_FORWARD(Types, args)...); + return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...); + } + template + inline SPROUT_CONSTEXPR sprout::basic_string::type, N> + make_string(Head&& head, Tail&&... tail) { + typedef sprout::detail::make_construct_impl< + sprout::basic_string::type, N> + > impl_type; + return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...); + } + template + inline SPROUT_CONSTEXPR sprout::basic_string::type, 1 + sizeof...(Tail)> + make_string(Head&& head, Tail&&... tail) { + typedef sprout::detail::make_construct_impl< + sprout::basic_string::type, 1 + sizeof...(Tail)> + > impl_type; + return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...); + } + template + inline SPROUT_CONSTEXPR sprout::basic_string::type, N> + make_string(Head&& head, Tail&&... tail) { + typedef sprout::detail::make_construct_impl< + sprout::basic_string::type, N> + > impl_type; + return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...); } } // namespace sprout diff --git a/sprout/type/string/to_string_constant.hpp b/sprout/type/string/to_string_constant.hpp index 6c9ffc21..6fdcca02 100644 --- a/sprout/type/string/to_string_constant.hpp +++ b/sprout/type/string/to_string_constant.hpp @@ -50,7 +50,7 @@ namespace sprout { typename Sequence::value_type, sprout::types::detail::str_length::value > to_string_constant_impl(sprout::index_tuple) { - return sprout::make_string_as( + return sprout::make_string( sprout::types::tuple_element::type::value... ); } diff --git a/sprout/valarray/make_valarray.hpp b/sprout/valarray/make_valarray.hpp index 91f283d3..dde612c0 100644 --- a/sprout/valarray/make_valarray.hpp +++ b/sprout/valarray/make_valarray.hpp @@ -32,6 +32,13 @@ namespace sprout { 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) { @@ -40,6 +47,14 @@ namespace sprout { 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 @@ -51,6 +66,13 @@ namespace sprout { 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) { @@ -59,6 +81,14 @@ namespace sprout { 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 @@ -68,6 +98,11 @@ namespace sprout { 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 diff --git a/sprout/valarray/mask_array.hpp b/sprout/valarray/mask_array.hpp index b73d95a5..fb26a3f8 100644 --- a/sprout/valarray/mask_array.hpp +++ b/sprout/valarray/mask_array.hpp @@ -5,8 +5,8 @@ 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_MASKE_ARRAY_HPP -#define SPROUT_VALARRAY_MASKE_ARRAY_HPP +#ifndef SPROUT_VALARRAY_MASK_ARRAY_HPP +#define SPROUT_VALARRAY_MASK_ARRAY_HPP #include #include @@ -231,4 +231,4 @@ namespace sprout { } } // namespace sprout -#endif // #ifndef SPROUT_VALARRAY_MASKE_ARRAY_HPP +#endif // #ifndef SPROUT_VALARRAY_MASK_ARRAY_HPP