mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-21 08:12:39 +02:00
Add DISABLE_VARIADIC_VECTOR and SFINAE for c++11 tuple element construction
This commit is contained in:
@ -13,9 +13,37 @@
|
||||
#define FUSION_AT get
|
||||
#include "construction.hpp"
|
||||
|
||||
// Bug in C++03 tuple? Cannot construct from a std::pair without including
|
||||
// std::pair fusion adaption
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
|
||||
# include <boost/fusion/adapted/std_pair.hpp>
|
||||
#endif
|
||||
|
||||
struct test_conversion
|
||||
{
|
||||
test_conversion(int value) : value_(value) {}
|
||||
|
||||
int value_;
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
const tuple<int, test_conversion> instance(std::pair<int, int>(1, 9));
|
||||
BOOST_TEST(boost::fusion::get<0>(instance) == 1);
|
||||
BOOST_TEST(boost::fusion::get<1>(instance).value_ == 9);
|
||||
}
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
const std::pair<int, int> init(16, 4);
|
||||
const tuple<int, test_conversion> instance(init);
|
||||
BOOST_TEST(boost::fusion::get<0>(instance) == 16);
|
||||
BOOST_TEST(boost::fusion::get<1>(instance).value_ == 4);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user