Implement ostream_joiner
This commit is contained in:
1 parent
a6b31015c6
commit
2dc89e1eee
8 files changed
+411
-3
No files matched your search
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/io/ostream_joiner.hpp>
|
||||
#include <sstream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream o;
|
||||
boost::io::ostream_joiner<char> j = boost::io::make_ostream_joiner(o, ',');
|
||||
*j++ = 1;
|
||||
*j++ = '2';
|
||||
*j++ = "3";
|
||||
BOOST_TEST_EQ(o.str(), "1,2,3");
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in new issue
Block a user