add string::append

This commit is contained in:
bolero-MURAKAMI 2016-03-23 18:18:26 +09:00
parent 8a4fca3aec
commit 2fce5bd7f9
3 changed files with 205 additions and 92 deletions

View file

@ -13,6 +13,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/workaround/std/cstddef.hpp> #include <sprout/workaround/std/cstddef.hpp>
#include <sprout/functional/bind2nd.hpp> #include <sprout/functional/bind2nd.hpp>
#include <sprout/iterator/next.hpp>
#include <sprout/iterator/ptr_index_iterator.hpp> #include <sprout/iterator/ptr_index_iterator.hpp>
#include <sprout/algorithm/find_if.hpp> #include <sprout/algorithm/find_if.hpp>
#include <sprout/algorithm/tristate_lexicographical_compare.hpp> #include <sprout/algorithm/tristate_lexicographical_compare.hpp>
@ -113,7 +114,7 @@ namespace sprout {
); );
} }
static SPROUT_CXX14_CONSTEXPR char_type* move(char_type* s1, char_type const* s2, std::size_t n) { static SPROUT_CXX14_CONSTEXPR char_type* move(char_type* s1, char_type const* s2, std::size_t n) {
sprout::copy_backward(s2, s2 + n, s1 + n); sprout::copy_backward(s2, s2 + n, sprout::next(s1, n));
return s1; return s1;
} }
static SPROUT_CXX14_CONSTEXPR char_type* copy(char_type* s1, char_type const* s2, std::size_t n) { static SPROUT_CXX14_CONSTEXPR char_type* copy(char_type* s1, char_type const* s2, std::size_t n) {
@ -160,56 +161,56 @@ namespace sprout {
} }
#endif #endif
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
template<typename ConstInputIterator> template<typename ForwardIterator>
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n) { static SPROUT_CONSTEXPR int compare(char_type const* s1, ForwardIterator s2, std::size_t n) {
return sprout::tristate_lexicographical_compare( return sprout::tristate_lexicographical_compare(
sprout::ptr_index(s1), sprout::ptr_index(s1, n), char_type(), sprout::ptr_index(s1), sprout::ptr_index(s1, n), char_type(),
s2, s2 + n, char_type(), s2, sprout::next(s2, n), char_type(),
sprout::detail::char_traits_lt<char_traits>() sprout::detail::char_traits_lt<char_traits>()
); );
} }
template<typename ConstInputIterator> template<typename ForwardIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n) { static SPROUT_CONSTEXPR int compare(ForwardIterator s1, char_type const* s2, std::size_t n) {
return sprout::tristate_lexicographical_compare( return sprout::tristate_lexicographical_compare(
s1, s1 + n, char_type(), s1, sprout::next(s1, n), char_type(),
sprout::ptr_index(s2), sprout::ptr_index(s2, n), char_type(), sprout::ptr_index(s2), sprout::ptr_index(s2, n), char_type(),
sprout::detail::char_traits_lt<char_traits>() sprout::detail::char_traits_lt<char_traits>()
); );
} }
template<typename ConstInputIterator1, typename ConstInputIterator2> template<typename ForwardIterator1, typename ForwardIterator2>
static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n) { static SPROUT_CONSTEXPR int compare(ForwardIterator1 s1, ForwardIterator2 s2, std::size_t n) {
return sprout::tristate_lexicographical_compare( return sprout::tristate_lexicographical_compare(
s1, s1 + n, char_type(), s1, sprout::next(s1, n), char_type(),
s2, s2 + n, char_type(), s2, sprout::next(s2, n), char_type(),
sprout::detail::char_traits_lt<char_traits>() sprout::detail::char_traits_lt<char_traits>()
); );
} }
template<typename ConstInputIterator> template<typename InputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s) { static SPROUT_CONSTEXPR std::size_t length(InputIterator s) {
return sprout::detail::strlen(s); return sprout::detail::strlen(s);
} }
template<typename ConstInputIterator> template<typename ForwardIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a) { static SPROUT_CONSTEXPR ForwardIterator find(ForwardIterator s, std::size_t n, char_type const& a) {
return sprout::ptr_unindex( return sprout::ptr_unindex(
sprout::find_if( sprout::find_if(
s, s + n, s, sprout::next(s, n),
sprout::bind2nd(sprout::detail::char_traits_eq<char_traits>(), a) sprout::bind2nd(sprout::detail::char_traits_eq<char_traits>(), a)
) )
); );
} }
template<typename OutputIterator, typename ConstInputIterator> template<typename BidirectionalIterator1, typename BidirectionalIterator2>
static SPROUT_CXX14_CONSTEXPR OutputIterator move(OutputIterator s1, ConstInputIterator s2, std::size_t n) { static SPROUT_CXX14_CONSTEXPR BidirectionalIterator1 move(BidirectionalIterator1 s1, BidirectionalIterator2 s2, std::size_t n) {
sprout::copy_backward(s2, s2 + n, s1 + n); sprout::copy_backward(s2, sprout::next(s2, n), sprout::next(s1, n));
return s1; return s1;
} }
template<typename OutputIterator, typename ConstInputIterator> template<typename OutputIterator, typename BidirectionalIterator>
static SPROUT_CXX14_CONSTEXPR OutputIterator copy(OutputIterator s1, ConstInputIterator s2, std::size_t n) { static SPROUT_CXX14_CONSTEXPR OutputIterator copy(OutputIterator s1, BidirectionalIterator s2, std::size_t n) {
sprout::copy(s2, s2 + n, s1); sprout::copy(s2, sprout::next(s2, n), s1);
return s1; return s1;
} }
template<typename OutputIterator> template<typename ForwardIterator>
static SPROUT_CXX14_CONSTEXPR OutputIterator assign(OutputIterator s, std::size_t n, char_type a) { static SPROUT_CXX14_CONSTEXPR ForwardIterator assign(ForwardIterator s, std::size_t n, char_type a) {
sprout::fill(s, s + n, a); sprout::fill(s, sprout::next(s, n), a);
return s; return s;
} }
#endif #endif
@ -243,19 +244,19 @@ namespace sprout {
return found != last; return found != last;
} }
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
template<typename ConstInputIterator> template<typename InputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s, std::size_t n) { static SPROUT_CONSTEXPR std::size_t length(InputIterator s, std::size_t n) {
return sprout::detail::strlen(s, n); return sprout::detail::strlen(s, n);
} }
template<typename ConstInputIterator> template<typename ForwardIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a) { static SPROUT_CONSTEXPR ForwardIterator find(ForwardIterator s, std::size_t n, char_type const& a) {
return sprout::find_if( return sprout::find_if(
s, s + n, s, sprout::next(s, n),
sprout::bind2nd(sprout::detail::char_traits_eq<traits_type>(), a) sprout::bind2nd(sprout::detail::char_traits_eq<traits_type>(), a)
); );
} }
template<typename ConstInputIterator> template<typename InputIterator>
static SPROUT_CONSTEXPR bool is_found(ConstInputIterator found, ConstInputIterator last) { static SPROUT_CONSTEXPR bool is_found(InputIterator found, InputIterator last) {
return found != last; return found != last;
} }
#endif #endif

View file

@ -43,11 +43,11 @@ namespace sprout {
)... )...
); );
} }
template<typename T, std::size_t N, typename Traits, std::size_t M, sprout::index_t... Indexes> template<typename T, std::size_t N, typename Traits, sprout::index_t... Indexes>
inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits> inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits>
string_rshift( string_rshift(
sprout::basic_string<T, N, Traits> const& lhs, std::size_t lsize, sprout::basic_string<T, N, Traits> const& lhs, std::size_t lsize,
T const (& rhs)[M], std::size_t rsize, T const* rhs, std::size_t rsize,
sprout::index_tuple<Indexes...> sprout::index_tuple<Indexes...>
) )
{ {
@ -90,13 +90,12 @@ namespace sprout {
sprout::make_index_tuple<N>::make() sprout::make_index_tuple<N>::make()
); );
} }
template<typename T, std::size_t N, typename Traits, std::size_t M> template<typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits> inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits>
operator<<(sprout::basic_string<T, N, Traits> const& lhs, T const (& rhs)[M]) { operator<<(sprout::basic_string<T, N, Traits> const& lhs, T const* rhs) {
typedef sprout::char_traits_helper<Traits> traits_type;
return sprout::detail::string_rshift( return sprout::detail::string_rshift(
lhs, lhs.size(), lhs, lhs.size(),
rhs, traits_type::length(rhs, M - 1), rhs, Traits::length(rhs),
sprout::make_index_tuple<N>::make() sprout::make_index_tuple<N>::make()
); );
} }
@ -128,11 +127,11 @@ namespace sprout {
)... )...
); );
} }
template<typename T, std::size_t N, typename Traits, std::size_t M, sprout::index_t... Indexes> template<typename T, std::size_t N, typename Traits, sprout::index_t... Indexes>
inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits> inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits>
string_lshift( string_lshift(
sprout::basic_string<T, N, Traits> const& lhs, std::size_t lsize, sprout::basic_string<T, N, Traits> const& lhs, std::size_t lsize,
T const (& rhs)[M], std::size_t rsize, T const* rhs, std::size_t rsize,
sprout::index_tuple<Indexes...> sprout::index_tuple<Indexes...>
) )
{ {
@ -175,13 +174,12 @@ namespace sprout {
sprout::make_index_tuple<N>::make() sprout::make_index_tuple<N>::make()
); );
} }
template<typename T, std::size_t N, typename Traits, std::size_t M> template<typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits> inline SPROUT_CONSTEXPR sprout::basic_string<T, N, Traits>
operator>>(sprout::basic_string<T, N, Traits> const& lhs, T const (& rhs)[M]) { operator>>(sprout::basic_string<T, N, Traits> const& lhs, T const* rhs) {
typedef sprout::char_traits_helper<Traits> traits_type;
return sprout::detail::string_lshift( return sprout::detail::string_lshift(
lhs, lhs.size(), lhs, lhs.size(),
rhs, traits_type::length(rhs, M - 1), rhs, Traits::length(rhs),
sprout::make_index_tuple<N>::make() sprout::make_index_tuple<N>::make()
); );
} }

View file

@ -292,12 +292,56 @@ namespace sprout {
} }
} }
SPROUT_CXX14_CONSTEXPR void put_terminator() { SPROUT_CXX14_CONSTEXPR void put_terminator() {
traits_type::assign(begin() + impl_.len, static_size - impl_.len, value_type()); traits_type::assign(begin() + size(), static_size - size(), value_type());
} }
SPROUT_CXX14_CONSTEXPR void put_terminator(size_type n) { SPROUT_CXX14_CONSTEXPR void put_terminator(size_type n) {
impl_.len = n; impl_.len = n;
put_terminator(); put_terminator();
} }
template<typename InputIterator>
SPROUT_CXX14_CONSTEXPR basic_string& assign(InputIterator first, InputIterator last, std::input_iterator_tag*) {
iterator it = begin();
for (; first != last; ++first, ++it) {
if (sprout::distance(begin(), it) > static_size) {
throw std::length_error("basic_string<>: length exceeded");
}
traits_type::assign(*it, *first);
}
put_terminator(sprout::distance(begin(), it));
return *this;
}
template<typename ForwardIterator>
SPROUT_CXX14_CONSTEXPR basic_string& assign(ForwardIterator first, ForwardIterator last, std::forward_iterator_tag*) {
lengthcheck(sprout::distance(first, last));
iterator it = begin();
for (; first != last; ++first, ++it) {
traits_type::assign(*it, *first);
}
put_terminator(sprout::distance(begin(), it));
return *this;
}
template<typename InputIterator>
SPROUT_CXX14_CONSTEXPR basic_string& append(InputIterator first, InputIterator last, std::input_iterator_tag*) {
iterator it = end();
for (; first != last; ++first, ++it) {
if (sprout::distance(begin(), it) > static_size) {
throw std::length_error("basic_string<>: length exceeded");
}
traits_type::assign(*it, *first);
}
put_terminator(size() + sprout::distance(end(), it));
return *this;
}
template<typename ForwardIterator>
SPROUT_CXX14_CONSTEXPR basic_string& append(ForwardIterator first, ForwardIterator last, std::forward_iterator_tag*) {
lengthcheck(size() + sprout::distance(first, last));
iterator it = end();
for (; first != last; ++first, ++it) {
traits_type::assign(*it, *first);
}
put_terminator(size() + sprout::distance(end(), it));
return *this;
}
public: public:
// construct/copy/destroy: // construct/copy/destroy:
SPROUT_CONSTEXPR basic_string() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL SPROUT_CONSTEXPR basic_string() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL
@ -545,23 +589,70 @@ namespace sprout {
// modifiers: // modifiers:
template<std::size_t N2> template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string& SPROUT_CXX14_CONSTEXPR basic_string&
append(basic_string<T, N2> const& str) {
return append(str.begin(), str.size());
}
template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string&
append(basic_string<T, N2> const& str, size_type pos, size_type n = npos) {
str.rangecheck(pos);
size_type rlen = n != npos
? NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos)
: str.size() - pos
;
return append(str.begin() + pos, rlen);
}
SPROUT_CXX14_CONSTEXPR basic_string&
append(value_type const* s, size_type n) {
lengthcheck(size() + n);
traits_type::move(end(), s, n);
put_terminator(size() + n);
return *this;
}
SPROUT_CXX14_CONSTEXPR basic_string&
append(value_type const* s) {
return append(s, traits_type::length(s));
}
SPROUT_CXX14_CONSTEXPR basic_string&
append(size_type n, value_type c) {
lengthcheck(size() + n);
traits_type::assign(end(), n, c);
put_terminator(size() + n);
return *this;
}
template<typename InputIterator>
SPROUT_CXX14_CONSTEXPR basic_string&
append(InputIterator first, InputIterator last) {
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
return append(first, last, category());
}
SPROUT_CXX14_CONSTEXPR basic_string&
append(std::initializer_list<value_type> il) {
return append(il.begin(), il.end());
}
SPROUT_CXX14_CONSTEXPR void
push_back(value_type c) {
append(size_type(1), c);
}
template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string&
assign(basic_string<T, N2, Traits> const& str) { assign(basic_string<T, N2, Traits> const& str) {
return assign(str, 0, npos); return assign(str, 0, npos);
} }
template<std::size_t N2> template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string& SPROUT_CXX14_CONSTEXPR basic_string&
assign(basic_string<T, N2, Traits> const& str, size_type pos, size_type n) { assign(basic_string<T, N2, Traits> const& str, size_type pos, size_type n = npos) {
if (str.size() < pos) { str.rangecheck(pos);
throw std::out_of_range("basic_string<>: index out of range"); size_type rlen = n != npos
} ? NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos)
return assign(str.begin() + pos, NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos)); : str.size() - pos
;
return assign(str.begin() + pos, rlen);
} }
SPROUT_CXX14_CONSTEXPR basic_string& SPROUT_CXX14_CONSTEXPR basic_string&
assign(value_type const* s, size_type n) { assign(value_type const* s, size_type n) {
lengthcheck(n); lengthcheck(n);
for (size_type i = 0; i < n; ++i) { traits_type::move(begin(), s, n);
traits_type::assign(impl_.elems[i], s[i]);
}
put_terminator(n); put_terminator(n);
return *this; return *this;
} }
@ -579,14 +670,19 @@ namespace sprout {
template<typename InputIterator> template<typename InputIterator>
SPROUT_CXX14_CONSTEXPR basic_string& SPROUT_CXX14_CONSTEXPR basic_string&
assign(InputIterator first, InputIterator last) { assign(InputIterator first, InputIterator last) {
size_type n = 0; typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
for (; n < static_size || first != last; ++n, ++first) { return assign(first, last, category());
traits_type::assign(impl_.elems[n], *first);
} }
put_terminator(n); SPROUT_CXX14_CONSTEXPR basic_string&
return *this; assign(std::initializer_list<value_type> il) {
return assign(il.begin(), il.end());
} }
SPROUT_CXX14_CONSTEXPR void SPROUT_CXX14_CONSTEXPR void
pop_back() {
put_terminator(size() - 1);
}
//!!!
SPROUT_CXX14_CONSTEXPR void
swap(basic_string& other) swap(basic_string& other)
SPROUT_NOEXCEPT_IF_EXPR(sprout::swap(std::declval<T&>(), std::declval<T&>())) SPROUT_NOEXCEPT_IF_EXPR(sprout::swap(std::declval<T&>(), std::declval<T&>()))
{ {
@ -614,6 +710,13 @@ namespace sprout {
c_array() const SPROUT_NOEXCEPT { c_array() const SPROUT_NOEXCEPT {
return impl_.elems; return impl_.elems;
} }
SPROUT_CXX14_CONSTEXPR size_type
copy(value_type* s, size_type n, size_type pos = 0) const {
rangecheck(pos);
size_type llen = NS_SSCRISK_CEL_OR_SPROUT::min(n, size() - pos);
traits_type::copy(s, begin() + pos, llen);
return llen;
}
template<std::size_t N2> template<std::size_t N2>
SPROUT_CONSTEXPR size_type SPROUT_CONSTEXPR size_type
find(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT { find(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT {
@ -770,7 +873,7 @@ namespace sprout {
} }
SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const { SPROUT_CXX14_CONSTEXPR void rangecheck(size_type i) const {
return i >= size() ? throw std::out_of_range("uuid: index out of range") return i >= size() ? throw std::out_of_range("basic_string<>: index out of range")
: (void)0 : (void)0
; ;
} }
@ -791,11 +894,28 @@ namespace sprout {
is_string_iterator<StringConstIterator>::value, is_string_iterator<StringConstIterator>::value,
basic_string& basic_string&
>::type >::type
append(StringConstIterator s, size_type n) {
lengthcheck(size() + n);
traits_type::move(end(), s, n);
put_terminator(size() + n);
return *this;
}
template<typename StringConstIterator>
SPROUT_CXX14_CONSTEXPR typename std::enable_if<
is_string_iterator<StringConstIterator>::value,
basic_string&
>::type
append(StringConstIterator s) {
return append(s, traits_type::length(s));
}
template<typename StringConstIterator>
SPROUT_CXX14_CONSTEXPR typename std::enable_if<
is_string_iterator<StringConstIterator>::value,
basic_string&
>::type
assign(StringConstIterator s, size_type n) { assign(StringConstIterator s, size_type n) {
lengthcheck(n); lengthcheck(n);
for (size_type i = 0; i < n; ++i) { traits_type::move(begin(), s, n);
traits_type::assign(impl_.elems[i], s[i]);
}
put_terminator(n); put_terminator(n);
return *this; return *this;
} }
@ -809,6 +929,14 @@ namespace sprout {
} }
// string operations (for string iterator): // string operations (for string iterator):
template<typename StringIterator>
SPROUT_CXX14_CONSTEXPR size_type
copy(StringIterator s, size_type n, size_type pos = 0) const {
rangecheck(pos);
size_type llen = NS_SSCRISK_CEL_OR_SPROUT::min(n, size() - pos);
traits_type::copy(s, begin() + pos, llen);
return llen;
}
template<typename StringConstIterator> template<typename StringConstIterator>
SPROUT_CONSTEXPR typename std::enable_if< SPROUT_CONSTEXPR typename std::enable_if<
is_string_iterator<StringConstIterator>::value, is_string_iterator<StringConstIterator>::value,
@ -973,52 +1101,38 @@ namespace sprout {
return sprout::distance(begin(), p); return sprout::distance(begin(), p);
} }
#endif #endif
SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(T const& rhs) { SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(T const& rhs) {
lengthcheck(size() + 1); push_back(rhs);
traits_type::assign(end(), 1, rhs);
put_terminator(impl_.len + 1);
return *this; return *this;
} }
template<std::size_t M> SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(value_type const* rhs) {
SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(T const (& rhs)[M]) { return append(rhs);
typedef sprout::char_traits_helper<traits_type> helper_type;
std::size_t rsize = helper_type::length(rhs, M - 1);
lengthcheck(size() + rsize);
traits_type::copy(end(), rhs, rsize);
put_terminator(impl_.len + rsize);
return *this;
} }
template<std::size_t N2> template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(basic_string<T, N2> const& rhs) { SPROUT_CXX14_CONSTEXPR basic_string& operator<<=(basic_string<T, N2, Traits> const& rhs) {
lengthcheck(size() + rhs.size()); return append(rhs);
traits_type::copy(end(), rhs.begin(), rhs.size());
put_terminator(impl_.len + rhs.size());
return *this;
} }
SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(T const& rhs) { SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(T const& rhs) {
lengthcheck(size() + 1); lengthcheck(size() + 1);
traits_type::move(begin() + 1, begin(), size()); traits_type::move(begin() + 1, begin(), size());
traits_type::assign(begin(), 1, rhs); traits_type::assign(begin(), 1, rhs);
put_terminator(impl_.len + 1); put_terminator(size() + 1);
return *this; return *this;
} }
template<std::size_t M> SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(value_type const* rhs) {
SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(T const (& rhs)[M]) { size_type rlen = traits_type::length(rhs);
typedef sprout::char_traits_helper<traits_type> helper_type; lengthcheck(size() + rlen);
std::size_t rsize = helper_type::length(rhs, M - 1); traits_type::move(begin() + rlen, begin(), size());
lengthcheck(size() + rsize); traits_type::move(begin(), rhs, rlen);
traits_type::move(begin() + rsize, begin(), size()); put_terminator(size() + rlen);
traits_type::copy(begin(), rhs, rsize);
put_terminator(impl_.len + rsize);
return *this; return *this;
} }
template<std::size_t N2> template<std::size_t N2>
SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(basic_string<T, N2> const& rhs) { SPROUT_CXX14_CONSTEXPR basic_string& operator>>=(basic_string<T, N2, Traits> const& rhs) {
lengthcheck(size() + rhs.size()); lengthcheck(size() + rhs.size());
traits_type::move(begin() + rhs.size(), begin(), size()); traits_type::move(begin() + rhs.size(), begin(), size());
traits_type::copy(begin(), rhs.begin(), rhs.size()); traits_type::move(begin(), rhs.begin(), rhs.size());
put_terminator(impl_.len + rhs.size()); put_terminator(size() + rhs.size());
return *this; return *this;
} }
}; };