2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
|
|
|
Copyright (c) 2011-2013 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)
|
|
|
|
=============================================================================*/
|
2012-04-14 10:06:21 +00:00
|
|
|
#ifndef SPROUT_STRING_CONTAINER_HPP
|
|
|
|
#define SPROUT_STRING_CONTAINER_HPP
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/utility/forward.hpp>
|
|
|
|
#include <sprout/string/string.hpp>
|
|
|
|
#include <sprout/container/traits.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// container_construct_traits
|
|
|
|
//
|
|
|
|
template<typename T, std::size_t N, typename Traits>
|
|
|
|
struct container_construct_traits<sprout::basic_string<T, N, Traits> > {
|
|
|
|
public:
|
|
|
|
typedef sprout::basic_string<T, N, Traits> copied_type;
|
|
|
|
public:
|
|
|
|
template<typename Cont>
|
2012-10-05 15:58:56 +00:00
|
|
|
static SPROUT_CONSTEXPR copied_type
|
|
|
|
deep_copy(Cont&& cont) {
|
2012-04-14 10:06:21 +00:00
|
|
|
return sprout::forward<Cont>(cont);
|
|
|
|
}
|
|
|
|
template<typename... Args>
|
2012-10-05 15:58:56 +00:00
|
|
|
static SPROUT_CONSTEXPR copied_type
|
|
|
|
make(Args&&... args) {
|
2012-04-14 10:06:21 +00:00
|
|
|
typedef sprout::detail::make_construct_impl<copied_type> impl_type;
|
2012-04-17 15:58:34 +00:00
|
|
|
return impl_type::make(sprout::forward<Args>(args)...);
|
2012-04-14 10:06:21 +00:00
|
|
|
}
|
|
|
|
template<typename Cont, typename... Args>
|
2012-10-05 15:58:56 +00:00
|
|
|
static SPROUT_CONSTEXPR copied_type
|
2013-07-22 13:00:09 +00:00
|
|
|
remake(Cont&&, typename sprout::container_traits<sprout::basic_string<T, N, Traits> >::difference_type size, Args&&... args) {
|
2012-04-14 10:06:21 +00:00
|
|
|
typedef sprout::detail::make_construct_impl<copied_type> impl_type;
|
2012-04-17 15:58:34 +00:00
|
|
|
return impl_type::make(static_cast<typename copied_type::size_type>(size), sprout::forward<Args>(args)...);
|
2012-04-14 10:06:21 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// container_transform_traits
|
|
|
|
//
|
|
|
|
template<typename T, std::size_t N, typename Traits>
|
|
|
|
struct container_transform_traits<sprout::basic_string<T, N, Traits> > {
|
|
|
|
public:
|
|
|
|
template<typename sprout::container_traits<sprout::basic_string<T, N, Traits> >::size_type Size>
|
|
|
|
struct rebind_size {
|
|
|
|
public:
|
|
|
|
typedef sprout::basic_string<T, Size, Traits> type;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_STRING_CONTAINER_HPP
|