2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2018-12-30 08:25:21 +00:00
|
|
|
Copyright (c) 2011-2018 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
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)
|
|
|
|
=============================================================================*/
|
2012-04-14 10:06:21 +00:00
|
|
|
#ifndef SPROUT_STRING_MAKE_STRING_HPP
|
|
|
|
#define SPROUT_STRING_MAKE_STRING_HPP
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/config.hpp>
|
2014-04-30 07:30:26 +00:00
|
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
2012-04-14 10:06:21 +00:00
|
|
|
#include <sprout/string/char_traits.hpp>
|
|
|
|
#include <sprout/string/string.hpp>
|
|
|
|
#include <sprout/utility/forward.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
2016-04-03 12:00:55 +00:00
|
|
|
namespace detail {
|
|
|
|
enum make_string_t {
|
|
|
|
make_string_in_head_type
|
|
|
|
};
|
|
|
|
} // namespace detail
|
2012-04-14 10:06:21 +00:00
|
|
|
//
|
|
|
|
// make_string
|
|
|
|
//
|
|
|
|
template<typename T>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<T>::type, 0>
|
2016-04-03 12:00:55 +00:00
|
|
|
make_string() {
|
2013-08-09 10:04:37 +00:00
|
|
|
return sprout::basic_string<typename std::decay<T>::type, 0>();
|
2012-04-14 10:06:21 +00:00
|
|
|
}
|
2016-04-03 12:00:55 +00:00
|
|
|
template<typename T, std::size_t N>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<T>::type, N>
|
|
|
|
make_string() {
|
|
|
|
return sprout::basic_string<typename std::decay<T>::type, N>();
|
|
|
|
}
|
|
|
|
template<typename T, typename Head, typename... Tail>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<T>::type, 1 + sizeof...(Tail)>
|
|
|
|
make_string(Head&& head, Tail&&... tail) {
|
|
|
|
typedef sprout::detail::make_construct_impl<
|
|
|
|
sprout::basic_string<typename std::decay<T>::type, 1 + sizeof...(Tail)>
|
|
|
|
> impl_type;
|
|
|
|
return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...);
|
|
|
|
}
|
|
|
|
template<typename T, std::size_t N, typename Head, typename... Tail>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<T>::type, N>
|
|
|
|
make_string(Head&& head, Tail&&... tail) {
|
|
|
|
typedef sprout::detail::make_construct_impl<
|
|
|
|
sprout::basic_string<typename std::decay<T>::type, N>
|
|
|
|
> impl_type;
|
|
|
|
return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...);
|
|
|
|
}
|
|
|
|
template<sprout::detail::make_string_t = sprout::detail::make_string_in_head_type, typename Head, typename... Tail>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<Head>::type, 1 + sizeof...(Tail)>
|
|
|
|
make_string(Head&& head, Tail&&... tail) {
|
|
|
|
typedef sprout::detail::make_construct_impl<
|
|
|
|
sprout::basic_string<typename std::decay<Head>::type, 1 + sizeof...(Tail)>
|
|
|
|
> impl_type;
|
|
|
|
return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...);
|
|
|
|
}
|
|
|
|
template<std::size_t N, sprout::detail::make_string_t = sprout::detail::make_string_in_head_type, typename Head, typename... Tail>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::basic_string<typename std::decay<Head>::type, N>
|
|
|
|
make_string(Head&& head, Tail&&... tail) {
|
2012-04-17 15:58:34 +00:00
|
|
|
typedef sprout::detail::make_construct_impl<
|
2016-04-03 12:00:55 +00:00
|
|
|
sprout::basic_string<typename std::decay<Head>::type, N>
|
2012-04-17 15:58:34 +00:00
|
|
|
> impl_type;
|
2016-04-03 12:00:55 +00:00
|
|
|
return impl_type::make(SPROUT_FORWARD(Head, head), SPROUT_FORWARD(Tail, tail)...);
|
2012-04-14 10:06:21 +00:00
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_STRING_MAKE_STRING_HPP
|