1 /*============================================================================= 2 Copyright (c) 1999-2003 Jaakko Jarvi 3 Copyright (c) 2001-2011 Joel de Guzman 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #include <boost/fusion/tuple/tuple.hpp> 9 #include <boost/fusion/adapted/mpl.hpp> 10 11 #define NO_CONSTRUCT_FROM_NIL 12 #define FUSION_SEQUENCE tuple 13 #define FUSION_AT get 14 #include "construction.hpp" 15 16 // Bug in C++03 tuple? Cannot construct from a std::pair without including 17 // std::pair fusion adaption 18 #if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) 19 # include <boost/fusion/adapted/std_pair.hpp> 20 #endif 21 22 struct test_conversion 23 { test_conversiontest_conversion24 test_conversion(int value) : value_(value) {} 25 26 int value_; 27 }; 28 29 int main()30main() 31 { 32 test(); 33 34 { 35 using namespace boost::fusion; 36 const tuple<int, test_conversion> instance(std::pair<int, int>(1, 9)); 37 BOOST_TEST(boost::fusion::get<0>(instance) == 1); 38 BOOST_TEST(boost::fusion::get<1>(instance).value_ == 9); 39 } 40 { 41 using namespace boost::fusion; 42 const std::pair<int, int> init(16, 4); 43 const tuple<int, test_conversion> instance(init); 44 BOOST_TEST(boost::fusion::get<0>(instance) == 16); 45 BOOST_TEST(boost::fusion::get<1>(instance).value_ == 4); 46 } 47 48 return boost::report_errors(); 49 } 50