Ticket #9648: boost_container_string_assign_optimization_v2.patch

File boost_container_string_assign_optimization_v2.patch, 983 bytes (added by Adam Romanek <romanek.adam@…>, 9 years ago)

fix proposal (v2)

  • boost/container/string.hpp

    diff -Naur .build/boost_1_54_0/boost/container/string.hpp .build/boost_1_54_0_patched/boost/container/string.hpp
    old new  
    12441244   basic_string& assign(const CharT* s)
    12451245   { return this->assign(s, s + Traits::length(s)); }
    12461246
     1247   //! <b>Effects</b>: Equivalent to assign(basic_string(first, last)).
     1248   //!
     1249   //! <b>Returns</b>: *this
     1250   basic_string& assign(const CharT* first, const CharT* last)
     1251   {
     1252      size_type n = std::distance(first, last);
     1253      this->reserve(n);
     1254      CharT* ptr = container_detail::to_raw_pointer(this->priv_addr());
     1255      Traits::copy(ptr, first, n);
     1256      this->priv_construct_null(ptr + n);
     1257      this->priv_size(n);
     1258      return *this;
     1259   }
     1260
    12471261   //! <b>Effects</b>: Equivalent to assign(basic_string(n, c)).
    12481262   //!
    12491263   //! <b>Returns</b>: *this