...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A type that meets the requirements for convertibility to a mutable buffer
must meet the requirements of CopyConstructible
types (C++ Std, 20.1.3), and the requirements of Assignable
types (C++ Std, 23.1).
In the table below, X
denotes
a class meeting the requirements for convertibility to a mutable buffer,
a
and b
denote values of type X
,
and u
, v
and w
denote identifiers.
Table 7. ConvertibleToMutableBuffer requirements
expression |
postcondition |
---|---|
mutable_buffer u(a); mutable_buffer v(a);
|
buffer_cast<void*>(u) == buffer_cast<void*>(v) && buffer_size(u) == buffer_size(v)
|
mutable_buffer u(a); mutable_buffer v = a;
|
buffer_cast<void*>(u) == buffer_cast<void*>(v) && buffer_size(u) == buffer_size(v)
|
mutable_buffer u(a); mutable_buffer v; v = a;
|
buffer_cast<void*>(u) == buffer_cast<void*>(v) && buffer_size(u) == buffer_size(v)
|
mutable_buffer u(a); const X& v = a; mutable_buffer w(v);
|
buffer_cast<void*>(u) == buffer_cast<void*>(w) && buffer_size(u) == buffer_size(w)
|
mutable_buffer u(a); X v(a); mutable_buffer w(v);
|
buffer_cast<void*>(u) == buffer_cast<void*>(w) && buffer_size(u) == buffer_size(w)
|
mutable_buffer u(a); X v = a; mutable_buffer w(v);
|
buffer_cast<void*>(u) == buffer_cast<void*>(w) && buffer_size(u) == buffer_size(w)
|
mutable_buffer u(a); X v(b); v = a; mutable_buffer w(v);
|
buffer_cast<void*>(u) == buffer_cast<void*>(w) && buffer_size(u) == buffer_size(w)
|