Skip to content

Commit 82f6d50

Browse files
committed
Added serialization support for std::set
1 parent 24f21da commit 82f6d50

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

include/vsg/io/stream.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
3030
#include <istream>
3131
#include <ostream>
3232
#include <sstream>
33+
#include <set>
3334

3435
namespace vsg
3536
{
@@ -333,4 +334,28 @@ namespace vsg
333334
return output;
334335
}
335336

337+
template<typename T>
338+
std::ostream& operator<<(std::ostream& output, const std::set<T>& values)
339+
{
340+
if (values.empty())
341+
output << "{}";
342+
else
343+
{
344+
output << "{ ";
345+
346+
bool first = true;
347+
for(auto& value : values)
348+
{
349+
if (!first) output << ", ";
350+
else first = false;
351+
352+
output << value;
353+
}
354+
355+
output << " }";
356+
}
357+
return output;
358+
}
359+
360+
336361
} // namespace vsg

0 commit comments

Comments
 (0)