/*============================================================================= Copyright (c) 2001-2016 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #include #include #include #include #include #include "test.hpp" namespace x3 = boost::spirit::x3; struct none {}; using variant = x3::variant< none , bool , std::string , int , double >; struct ast : variant { using variant::variant; using variant::operator=; ast(char const* s) : variant(std::string{s}) {} ast& operator=(char const* s) { variant::operator=(std::string{s}); return *this; } }; int main() { { ast v{123}; BOOST_TEST(boost::get(v) == 123); v = "test"; BOOST_TEST(boost::get(v) == "test"); v = true; BOOST_TEST(boost::get(v) == true); } return boost::report_errors(); }