// No need of this anymore
this->~basic_fbstring();
// Move the goner into this
- new(&store_) fbstring_core<E>(std::move(goner.store_));
+ new (&store_) Storage(std::move(goner.store_));
return *this;
}
assert(size() == n);
} else {
const value_type *const s2 = s + size();
- fbstring_detail::pod_move(s, s2, store_.mutable_data());
+ // size() < n!so [s,s + n) and [data(),data() + size()] can not overlap
+ // so we can use pod_copy instead of pod_move.
+ fbstring_detail::pod_copy(s, s2, store_.mutable_data());
append(s2, n - size());
assert(size() == n);
}
}
iterator insert(const_iterator p, const value_type c) {
- const size_type pos = p - begin();
+ const size_type pos = p - cbegin();
insert(p, 1, c);
return begin() + pos;
}
size_type n, value_type c, Selector<1>) {
Invariant checker(*this);
- assert(i >= begin() && i <= end());
- const size_type pos = i - begin();
+ assert(i >= cbegin() && i <= cend());
+ const size_type pos = i - cbegin();
auto oldSize = size();
store_.expand_noinit(n, /* expGrowth = */ true);
std::forward_iterator_tag) {
Invariant checker(*this);
- assert(i >= begin() && i <= end());
- const size_type pos = i - begin();
+ assert(i >= cbegin() && i <= cend());
+ const size_type pos = i - cbegin();
auto n = std::distance(s1, s2);
assert(n >= 0);
iterator insertImpl(const_iterator i,
InputIterator b, InputIterator e,
std::input_iterator_tag) {
- const auto pos = i - begin();
- basic_fbstring temp(begin(), i);
+ const auto pos = i - cbegin();
+ basic_fbstring temp(cbegin(), i);
for (; b != e; ++b) {
temp.push_back(*b);
}