0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-01 08:18:20 +02:00

ircd::util: Add overload to ircd::string() to pubsetbuf() a provided buffer.

This commit is contained in:
Jason Volk 2018-09-27 17:00:15 -07:00
parent b93b4e31f6
commit 0d4013536a
2 changed files with 14 additions and 1 deletions

View file

@ -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)

View file

@ -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"