From 58661d65647ae3e68046df13545741ad523a2ca4 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 21 Feb 2020 20:21:43 -0500 Subject: [PATCH] Code reorganization --- include/boost/static_string/static_string.hpp | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index 4bfdf9f..cd67705 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -2026,7 +2026,11 @@ public: #endif append( InputIterator first, - InputIterator last); + InputIterator last) + { + this->set_size(size() + read_back(true, first, last)); + return term(); + } /** Append to the string. @@ -2430,7 +2434,12 @@ public: copy( pointer dest, size_type count, - size_type pos = 0) const; + size_type pos = 0) const + { + const auto num_copied = capped_length(pos, count); + traits_type::copy(dest, data() + pos, num_copied); + return num_copied; + } /** Change the size of the string. @@ -4120,7 +4129,12 @@ private: basic_static_string& assign_unchecked( const_pointer s, - size_type count) noexcept; + size_type count) noexcept + { + this->set_size(count); + traits_type::copy(data(), s, size() + 1); + return *this; + } BOOST_STATIC_STRING_CPP14_CONSTEXPR size_type @@ -4486,7 +4500,7 @@ operator<<( std::basic_ostream& os, const basic_static_string& s) { - return os << boost::static_string::basic_string_view(s.data(), s.size()); + return os << basic_string_view(s.data(), s.size()); } //------------------------------------------------------------------------------ @@ -4954,34 +4968,6 @@ append( return term(); } -template -template -BOOST_STATIC_STRING_CPP14_CONSTEXPR -auto -basic_static_string:: -append( - InputIterator first, - InputIterator last) -> - typename std::enable_if< - detail::is_input_iterator::value, - basic_static_string&>::type -{ - this->set_size(size() + read_back(true, first, last)); - return term(); -} - -template -BOOST_STATIC_STRING_CPP14_CONSTEXPR -auto -basic_static_string:: -copy(pointer dest, size_type count, size_type pos) const -> - size_type -{ - const auto num_copied = capped_length(pos, count); - traits_type::copy(dest, data() + pos, num_copied); - return num_copied; -} - template BOOST_STATIC_STRING_CPP14_CONSTEXPR void @@ -5347,21 +5333,6 @@ insert_unchecked( this->set_size(curr_size + count); return curr_data + index; } - -template -BOOST_STATIC_STRING_CPP14_CONSTEXPR -auto -basic_static_string:: -assign_unchecked( - const_pointer s, - size_type count) noexcept -> - basic_static_string& -{ - this->set_size(count); - traits_type::copy(data(), s, size() + 1); - return *this; -} - } // static_string } // boost #endif