mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
MacOS built: add workaround for missing view() member of std::ostringstream
This commit is contained in:
parent
caf3b55891
commit
e21c7895eb
11 changed files with 39 additions and 19 deletions
|
@ -6,6 +6,21 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
struct view_stringbuf : public std::stringbuf
|
||||
{
|
||||
inline std::string_view toView()
|
||||
{
|
||||
auto begin = pbase();
|
||||
return {begin, begin + pubseekoff(0, std::ios_base::cur, std::ios_base::out)};
|
||||
}
|
||||
};
|
||||
|
||||
std::string_view toView(const std::ostringstream & os)
|
||||
{
|
||||
auto buf = static_cast<view_stringbuf *>(os.rdbuf());
|
||||
return buf->toView();
|
||||
}
|
||||
|
||||
template std::list<std::string> tokenizeString(std::string_view s, std::string_view separators);
|
||||
template std::set<std::string> tokenizeString(std::string_view s, std::string_view separators);
|
||||
template std::vector<std::string> tokenizeString(std::string_view s, std::string_view separators);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue