]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/variant2/test/variant_ostream_insert.cpp
1 // Copyright 2021 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
5 #include <boost/variant2/variant.hpp>
6 #include <boost/core/lightweight_test.hpp>
10 using namespace boost::variant2
;
12 template<class T
> std::string
to_string( T
const& t
)
14 std::ostringstream os
;
24 BOOST_TEST_EQ( to_string( monostate() ), "monostate" );
28 variant
<monostate
, int, float, std::string
> v
;
30 BOOST_TEST_EQ( to_string( v
), to_string( monostate() ) );
33 BOOST_TEST_EQ( to_string( v
), to_string( 1 ) );
36 BOOST_TEST_EQ( to_string( v
), to_string( 3.14f
) );
39 BOOST_TEST_EQ( to_string( v
), to_string( "test" ) );
42 return boost::report_errors();