mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 12:07:36 +02:00
merge from trunk
[SVN r42226]
This commit is contained in:
@ -81,7 +81,6 @@ import testing ;
|
||||
[ run sequence/single_view.cpp : : : : ]
|
||||
[ run sequence/std_pair.cpp : : : : ]
|
||||
[ run sequence/array.cpp : : : : ]
|
||||
[ run sequence/variant.cpp : : : : ]
|
||||
[ run sequence/tuple_comparison.cpp : : : : ]
|
||||
[ run sequence/tuple_construction.cpp : : : : ]
|
||||
[ run sequence/tuple_copy.cpp : : : : ]
|
||||
|
@ -42,6 +42,9 @@ BOOST_FUSION_ADAPT_STRUCT(
|
||||
(int, y)
|
||||
)
|
||||
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, (int, m))
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -101,6 +104,16 @@ main()
|
||||
l = p;
|
||||
}
|
||||
|
||||
{ // begin/end
|
||||
using namespace boost::fusion;
|
||||
using boost::is_same;
|
||||
|
||||
typedef result_of::begin<s>::type b;
|
||||
typedef result_of::end<s>::type e;
|
||||
// this fails
|
||||
BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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 <boost/fusion/adapted/variant.hpp>
|
||||
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/support/is_view.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
namespace fusion = boost::fusion;
|
||||
typedef boost::variant<double, std::string> var_type;
|
||||
var_type var = "hello";
|
||||
|
||||
BOOST_MPL_ASSERT((fusion::traits::is_sequence<var_type>));
|
||||
BOOST_MPL_ASSERT_NOT((fusion::traits::is_view<var_type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::traits::category_of<var_type>::type,
|
||||
fusion::forward_traversal_tag>));
|
||||
|
||||
BOOST_TEST(fusion::size(var) == 2);
|
||||
BOOST_TEST(fusion::distance(fusion::begin(var), fusion::end(var)) == 2);
|
||||
BOOST_TEST(*fusion::next(fusion::begin(var)) == "hello");
|
||||
BOOST_TEST(fusion::next(fusion::next(fusion::begin(var))) == fusion::end(var));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::result_of::value_of<fusion::result_of::begin<var_type>::type>::type,
|
||||
double>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::result_of::value_of<fusion::result_of::next<fusion::result_of::begin<var_type>::type>::type>::type,
|
||||
std::string>));
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user