MCPcopy Create free account
hub / github.com/boostorg/json / replace

Method replace

include/boost/json/impl/string.hpp:116–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114// FowardIterator or better, as we can use std::distance
115template<class InputIt, class>
116auto
117string::
118replace(
119 const_iterator first,
120 const_iterator last,
121 InputIt first2,
122 InputIt last2) ->
123 string&
124{
125 struct cleanup
126 {
127 detail::string_impl& s;
128 storage_ptr const& sp;
129
130 ~cleanup()
131 {
132 s.destroy(sp);
133 }
134 };
135
136 // We use the default storage because
137 // the allocation is immediately freed.
138 storage_ptr dsp;
139 detail::string_impl tmp(
140 first2, last2, dsp,
141 iter_cat<InputIt>{});
142 cleanup c{tmp, dsp};
143 std::memcpy(
144 impl_.replace_unchecked(
145 first - begin(),
146 last - first,
147 tmp.size(),
148 sp_),
149 tmp.data(),
150 tmp.size());
151 return *this;
152}
153
154//----------------------------------------------------------
155

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected