@@ -160,40 +160,58 @@ void test(Variant & v)
160160
161161#include < boost/serialization/variant.hpp>
162162
163- int test_main ( int /* argc */ , char * /* argv */ [] ){
163+ # include < boost/variant/variant.hpp >
164164
165- // boost::variant - compatible with C++03
166- {
167- boost::variant<bool , int , float , double , A, std::string> v;
168- test (v);
169- const A a;
170- boost::variant<bool , int , float , double , const A *, std::string> v1 = & a;
171- test_type (v1);
172- }
165+ #include < cstdio>
166+
167+ int test_boost_variant (){
168+ std::cerr << " Testing boost_variant\n " ;
169+ boost::variant<bool , int , float , double , A, std::string> v;
170+ test (v);
171+ const A a;
172+ boost::variant<bool , int , float , double , const A *, std::string> v1 = & a;
173+ test_type (v1);
174+ return EXIT_SUCCESS ;
175+ }
176+
177+ // boost::variant2/variant requires C++ 11
178+ #if BOOST_CXX_VERSION >= 201103L
179+ #include < boost/variant2/variant.hpp>
180+
181+ int test_boost_variant2 (){
182+ std::cerr << " Testing boost_variant2\n " ;
183+ boost::variant2::variant<bool , int , float , double , A, std::string> v;
184+ test (v);
185+ const A a;
186+ boost::variant2::variant<bool , int , float , double , const A *, std::string> v1 = & a;
187+ test_type (v1);
188+ return EXIT_SUCCESS ;
189+ }
190+ #endif
191+
192+ // std::variant reqires C++ 17 or more
193+ #ifndef BOOST_NO_CXX17_HDR_VARIANT
194+ #include < variant>
195+ int test_std_variant (){
196+ std::cerr << " Testing Std Variant\n " ;
197+ std::variant<bool , int , float , double , A, std::string> v;
198+ test (v);
199+ const A a;
200+ std::variant<bool , int , float , double , const A *, std::string> v1 = & a;
201+ test_type (v1);
202+ return EXIT_SUCCESS ;
203+ }
204+ #endif
173205
174- // boost::variant2/variant requires C++ 11
206+ int test_main ( int /* argc */ , char * /* argv */ [] ){
207+ return test_boost_variant ()
175208 #if BOOST_CXX_VERSION >= 201103L
176- {
177- boost::variant2::variant<bool , int , float , double , A, std::string> v;
178- test (v);
179- const A a;
180- boost::variant2::variant<bool , int , float , double , const A *, std::string> v1 = & a;
181- test_type (v1);
182- }
209+ || test_boost_variant2 ()
183210 #endif
184-
185- // std::variant reqires C++ 17 or more
186211 #ifndef BOOST_NO_CXX17_HDR_VARIANT
187- {
188- std::variant<bool , int , float , double , A, std::string> v;
189- test (v);
190- const A a;
191- std::variant<bool , int , float , double , const A *, std::string> v1 = & a;
192- test_type (v1);
193- }
212+ || test_std_variant ()
194213 #endif
195-
196- return EXIT_SUCCESS ;
214+ ;
197215}
198216
199217// EOF
0 commit comments