boost::text::basic_unencoded_rope
// In header: <boost/text/unencoded_rope.hpp> template<typename Char, typename String> struct basic_unencoded_rope : public boost::stl_interfaces::sequence_container_interface< basic_unencoded_rope< Char, String >, boost::stl_interfaces::element_layout::discontiguous > { // types typedef Char value_type; typedef value_type * pointer; typedef value_type const * const_pointer; typedef value_type const & reference; typedef reference const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef unspecified iterator; typedef iterator const_iterator; typedef stl_interfaces::reverse_iterator< iterator > reverse_iterator; typedef reverse_iterator const_reverse_iterator; typedef String string; typedef basic_string_view< Char > string_view; typedef basic_unencoded_rope_view< value_type, string > unencoded_rope_view; typedef boost::stl_interfaces::sequence_container_interface< basic_unencoded_rope< Char, String >, boost::stl_interfaces::element_layout::discontiguous > base_type; // construct/copy/destruct basic_unencoded_rope(); basic_unencoded_rope(basic_unencoded_rope const &) = default; basic_unencoded_rope(basic_unencoded_rope &&); basic_unencoded_rope(value_type const *); explicit basic_unencoded_rope(unencoded_rope_view); explicit basic_unencoded_rope(string &&); template<std::ranges::range R> explicit basic_unencoded_rope(R const &); template<std::input_iterator I, std::sentinel_for< I > S> basic_unencoded_rope(I, S); basic_unencoded_rope & operator=(basic_unencoded_rope const &) = default; basic_unencoded_rope & operator=(basic_unencoded_rope &&); basic_unencoded_rope & operator=(unencoded_rope_view); basic_unencoded_rope & operator=(string); basic_unencoded_rope & operator=(value_type const *); // public member functions const_iterator begin(); const_iterator end(); size_type max_size() const; template<typename... Args> const_reference emplace_front(Args &&...); template<typename... Args> const_reference emplace_back(Args &&...); template<typename... Args> const_iterator emplace(const_iterator, Args &&...); unencoded_rope_view operator()(std::ptrdiff_t, std::ptrdiff_t) const; int compare(basic_unencoded_rope) const; operator unencoded_rope_view() const; basic_unencoded_rope & erase(const_iterator, const_iterator); basic_unencoded_rope & erase(unencoded_rope_view); basic_unencoded_rope & replace(const_iterator, const_iterator, value_type const *); basic_unencoded_rope & replace(const_iterator, const_iterator, unencoded_rope_view); basic_unencoded_rope & replace(const_iterator, const_iterator, string &&); template<std::ranges::range R> basic_unencoded_rope & replace(const_iterator, const_iterator, R const &); template<std::input_iterator I, std::sentinel_for< I > S> basic_unencoded_rope & replace(const_iterator, const_iterator, I, S); template<typename R> auto replace(unencoded_rope_view const &, R &&); template<std::input_iterator I, std::sentinel_for< I > S> auto replace(unencoded_rope_view const &, I, S); template<typename R> auto insert(const_iterator, R &&); template<std::input_iterator I, std::sentinel_for< I > S> auto insert(const_iterator, I, S); template<typename T> auto operator+=(T &&); void swap(basic_unencoded_rope &); bool equal_root(basic_unencoded_rope) const; // friend functions std::ostream & operator<<(std::ostream &, basic_unencoded_rope); };
A mutable sequence of Char
with copy-on-write semantics, and very cheap mutations at any point in the sequence (beginning, middle, or end). A basic_unencoded_rope
is non-contiguous and is not null-terminated.
basic_unencoded_rope
public
typestypedef basic_unencoded_rope_view< value_type, string > unencoded_rope_view;
The specialization of unencoded_rope_view
with the same value_type
and string
.
basic_unencoded_rope
public
construct/copy/destructbasic_unencoded_rope();
Default ctor.
Postconditions: |
size() == 0 && begin() == end() |
basic_unencoded_rope(basic_unencoded_rope const &) = default;
basic_unencoded_rope(basic_unencoded_rope &&);
basic_unencoded_rope(value_type const * c_str);
Constructs a basic_unencoded_rope
from a null-terminated string.
explicit basic_unencoded_rope(unencoded_rope_view rv);
Constructs a
from a basic_unencoded_rope
. basic_unencoded_rope_view
explicit basic_unencoded_rope(string && s);
Move-constructs a
from a basic_unencoded_rope
string
.
template<std::ranges::range R> explicit basic_unencoded_rope(R const & r);
Constructs a
from a range of basic_unencoded_rope
value_type
elements.
template<std::input_iterator I, std::sentinel_for< I > S> basic_unencoded_rope(I first, S last);
Constructs a
from a sequence of basic_unencoded_rope
value_type
.
basic_unencoded_rope & operator=(basic_unencoded_rope const &) = default;
basic_unencoded_rope & operator=(basic_unencoded_rope &&);
basic_unencoded_rope & operator=(unencoded_rope_view rv);
Assignment from a
. basic_unencoded_rope_view
basic_unencoded_rope & operator=(string s);
Move-assignment from a string
.
basic_unencoded_rope & operator=(value_type const * c_str);
Assignment from a null-terminated string.
basic_unencoded_rope
public member functionsconst_iterator begin();
const_iterator end();
size_type max_size() const;
template<typename... Args> const_reference emplace_front(Args &&... args);
template<typename... Args> const_reference emplace_back(Args &&... args);
template<typename... Args> const_iterator emplace(const_iterator at, Args &&... args);
unencoded_rope_view operator()(std::ptrdiff_t lo, std::ptrdiff_t hi) const;
Returns a substring of *this
as an unencoded_rope_view
, comprising the elements at offsets [lo, hi)
. If either of lo
or hi
is a negative value x
, x
is taken to be an offset from the end, and so x + size()
is used instead.
These preconditions apply to the values used after size()
is added to any negative arguments.
Requires: |
0 <= lo && lo <= size() |
Requires: |
0 <= hi && lhi <= size() |
Requires: |
lo <= hi |
int compare(basic_unencoded_rope rhs) const;
Lexicographical compare. Returns a value < 0
when *this
is lexicographically less than rhs,
0if
*this == rhs, and a value
> 0if
*thisis lexicographically greater than
rhs`.
operator unencoded_rope_view() const;
basic_unencoded_rope & erase(const_iterator first, const_iterator last);
Erases the portion of *this
delimited by [first, last)
.
Requires: |
rv.begin() <= rv.begin() && rv.end() <= end() |
basic_unencoded_rope & erase(unencoded_rope_view rv);
Erases the portion of *this
delimited by rv
.
Requires: |
rv.begin() <= rv.begin() && rv.end() <= end() |
basic_unencoded_rope & replace(const_iterator first, const_iterator last, value_type const * c_str);
Replaces the portion of *this
delimited by [first, last)
with c_str
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
basic_unencoded_rope & replace(const_iterator first, const_iterator last, unencoded_rope_view rv);
Replaces the portion of *this
delimited by [first, last)
with rv
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
basic_unencoded_rope & replace(const_iterator first, const_iterator last, string && s);
Replaces the portion of *this
delimited by [first, last)
with s
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<std::ranges::range R> basic_unencoded_rope & replace(const_iterator first, const_iterator last, R const & r);
Replaces the portion of *this
delimited by [first, last)
with r
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<std::input_iterator I, std::sentinel_for< I > S> basic_unencoded_rope & replace(const_iterator first1, const_iterator last1, I first2, S last2);
Replaces the portion of *this
delimited by [first1, last1)
with [first2, last2)
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<typename R> auto replace(unencoded_rope_view const & old_substr, R && r);
Replaces the portion of *this
delimited by old_substr
with r
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<std::input_iterator I, std::sentinel_for< I > S> auto replace(unencoded_rope_view const & old_substr, I first, S last);
Replaces the portion of *this
delimited by old_substr
with [first, last)
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<typename R> auto insert(const_iterator at, R && r);
Inserts r
into *this
at position at
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<std::input_iterator I, std::sentinel_for< I > S> auto insert(const_iterator at, I first, S last);
Inserts [first, last)
into *this
at position at
.
Requires: |
begin() <= old_substr.begin() && old_substr.end() <= end() |
template<typename T> auto operator+=(T && x);
Appends x
to *this
.
void swap(basic_unencoded_rope & other);
bool equal_root(basic_unencoded_rope other) const;
Returns true if *this
and other
contain the same root node pointer. This is useful when you want to check for equality between two
s that are likely to have originated from the same initial basic_unencoded_rope
, and may have since been mutated. basic_unencoded_rope
basic_unencoded_rope
friend functionsstd::ostream & operator<<(std::ostream & os, basic_unencoded_rope r);
Stream inserter; performs unformatted output.