mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
add to_string
This commit is contained in:
parent
89e2be54fa
commit
1968a6fac4
16 changed files with 1490 additions and 1085 deletions
54
sprout/string/container.hpp
Normal file
54
sprout/string/container.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
#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>
|
||||
static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) {
|
||||
return sprout::forward<Cont>(cont);
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type make(Args&&... args) {
|
||||
typedef sprout::detail::make_construct_impl<copied_type> impl_type;
|
||||
return impl_type::make(impl_type::length(sprout::forward<Args>(args)...), sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type remake(
|
||||
Cont&& cont,
|
||||
typename sprout::container_traits<sprout::basic_string<T, N, Traits> >::difference_type size,
|
||||
Args&&... args
|
||||
)
|
||||
{
|
||||
typedef sprout::detail::make_construct_impl<copied_type> impl_type;
|
||||
return impl_type::make(size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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
|
Loading…
Add table
Add a link
Reference in a new issue