mirror of
https://github.com/matrix-construct/construct
synced 2024-10-06 07:38:52 +02:00
ircd:Ⓜ️🆔 Add function to update buffer's view after direct write.
This commit is contained in:
parent
cc7dd13e4e
commit
8b7b8bb584
1 changed files with 10 additions and 0 deletions
|
@ -237,6 +237,16 @@ struct ircd::m::id::buf
|
||||||
return b;
|
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>
|
template<class... args>
|
||||||
buf(args&&... a)
|
buf(args&&... a)
|
||||||
:T{b, std::forward<args>(a)...}
|
:T{b, std::forward<args>(a)...}
|
||||||
|
|
Loading…
Reference in a new issue