mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 16:33:53 +01:00
ircd::util: Add overload to ircd::string() to pubsetbuf() a provided buffer.
This commit is contained in:
parent
b93b4e31f6
commit
0d4013536a
2 changed files with 14 additions and 1 deletions
|
@ -32,6 +32,19 @@ string(const T &s)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
/// Alternative to ircd::string() using a provided buffer for the
|
||||
/// std::stringstream to avoid allocating one.
|
||||
template<class T>
|
||||
auto
|
||||
string(const mutable_buffer &buf,
|
||||
const T &s)
|
||||
{
|
||||
std::stringstream ss;
|
||||
pubsetbuf(ss, buf);
|
||||
ss << s;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
inline auto
|
||||
string(const char *const &buf,
|
||||
const size_t &size)
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace ircd
|
|||
#include "tuple.h"
|
||||
#include "timer.h"
|
||||
#include "life_guard.h"
|
||||
#include "string.h"
|
||||
#include "pubsetbuf.h"
|
||||
#include "string.h"
|
||||
#include "pointers.h"
|
||||
#include "iterator.h"
|
||||
#include "nothrow.h"
|
||||
|
|
Loading…
Reference in a new issue