0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-05 10:08:36 +02:00

ircd:Ⓜ️🆔 Add function to update buffer's view after direct write.

This commit is contained in:
Jason Volk 2018-03-05 00:52:24 -08:00
parent cc7dd13e4e
commit 8b7b8bb584

View file

@ -237,6 +237,16 @@ struct ircd::m::id::buf
return b;
}
/// Due to the normal semantics of this object in relation to its parent,
/// if you write directly to this as a mutable_buffer you can call
/// assigned() to update this.
buf &assigned(const T &t)
{
assert(string_view{t}.data() == b.data());
static_cast<string_view &>(*this) = t;
return *this;
}
template<class... args>
buf(args&&... a)
:T{b, std::forward<args>(a)...}