// Copyright 2022 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #if defined(BOOST_GCC) && BOOST_GCC < 50000 # define BOOST_ALLOW_DEPRECATED #endif #include #include #include #include #include using namespace boost::variant2; namespace json = boost::json; int main() { { monostate m; json::value w = json::value_from( m ); BOOST_TEST_EQ( w, json::value( nullptr ) ); } { variant v; json::value w = json::value_from( v ); BOOST_TEST_EQ( w, json::value( nullptr ) ); } { variant v( 17 ); json::value w = json::value_from( v ); BOOST_TEST_EQ( w, json::value( 17 ) ); } { variant v( "test" ); json::value w = json::value_from( v ); BOOST_TEST_EQ( w, json::value( "test" ) ); } return boost::report_errors(); }