forked from boostorg/fusion
merge from trunk
[SVN r56179]
This commit is contained in:
1 parent
2f8b91828b
commit
2e805be6df
281 files changed
+9335
-11649
No files matched your search
+2
-6
@@ -112,16 +112,12 @@ import testing ;
|
||||
[ run functional/fused.cpp : : : : ]
|
||||
[ run functional/fused_function_object.cpp : : : : ]
|
||||
[ run functional/fused_procedure.cpp : : : : ]
|
||||
[ run functional/unfused_generic.cpp : : : : ]
|
||||
[ run functional/unfused_lvalue_args.cpp : : : : ]
|
||||
[ run functional/unfused_rvalue_args.cpp : : : : ]
|
||||
[ run functional/unfused.cpp : : : : ]
|
||||
[ run functional/unfused_typed.cpp : : : : ]
|
||||
[ run functional/make_fused.cpp : : : : ]
|
||||
[ run functional/make_fused_function_object.cpp : : : : ]
|
||||
[ run functional/make_fused_procedure.cpp : : : : ]
|
||||
[ run functional/make_unfused_generic.cpp : : : : ]
|
||||
[ run functional/make_unfused_lvalue_args.cpp : : : : ]
|
||||
[ run functional/make_unfused_rvalue_args.cpp : : : : ]
|
||||
[ run functional/make_unfused.cpp : : : : ]
|
||||
[ run functional/invoke.cpp : : : : ]
|
||||
[ run functional/invoke_function_object.cpp : : : : ]
|
||||
[ run functional/invoke_procedure.cpp : : : : ]
|
||||
|
||||
@@ -33,12 +33,24 @@ namespace
|
||||
int
|
||||
main()
|
||||
{
|
||||
{
|
||||
boost::fusion::vector<> t;
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, short, double> t(1, 2, 3.3);
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, short, double, long> t(1, 2, 3.3, 2);
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
|
||||
BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, short, double> t(1, 2, 3.3);
|
||||
BOOST_TEST((!boost::fusion::all(t, boost::lambda::_1 == 1)));
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#=============================================================================
|
||||
# Copyright (c) 2008 Dan Marsden
|
||||
#
|
||||
# Use modification and distribution are subject to 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).
|
||||
#==============================================================================
|
||||
|
||||
CXX=g++
|
||||
CXXFLAGS=-I$(BOOST_ROOT)
|
||||
|
||||
TEST_SRCS=\
|
||||
vector_construction.cpp\
|
||||
vector_iteration.cpp\
|
||||
vector_intrinsic.cpp\
|
||||
fold.cpp\
|
||||
transform.cpp
|
||||
|
||||
TEST_OBJS=$(TEST_SRCS:.cpp=.o)
|
||||
|
||||
TEST_TARGETS=$(TEST_SRCS:.cpp=.test)
|
||||
|
||||
all: $(TEST_TARGETS)
|
||||
|
||||
%.test : %.cpp
|
||||
time $(CXX) $(CXXFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(TEST_TARGETS) $(TEST_OBJS)
|
||||
@@ -0,0 +1,75 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_FUSION_COMPILE_TIME_DRIVER)
|
||||
#define BOOST_FUSION_COMPILE_TIME_DRIVER
|
||||
|
||||
int main()
|
||||
{
|
||||
test<0>();
|
||||
test<1>();
|
||||
test<2>();
|
||||
test<3>();
|
||||
test<4>();
|
||||
|
||||
test<5>();
|
||||
test<6>();
|
||||
test<7>();
|
||||
test<8>();
|
||||
test<9>();
|
||||
|
||||
test<10>();
|
||||
test<11>();
|
||||
test<12>();
|
||||
test<13>();
|
||||
test<14>();
|
||||
|
||||
test<15>();
|
||||
test<16>();
|
||||
test<17>();
|
||||
test<18>();
|
||||
test<19>();
|
||||
|
||||
test<20>();
|
||||
test<21>();
|
||||
test<22>();
|
||||
test<23>();
|
||||
test<24>();
|
||||
|
||||
test<25>();
|
||||
test<26>();
|
||||
test<27>();
|
||||
test<28>();
|
||||
test<29>();
|
||||
|
||||
test<30>();
|
||||
test<31>();
|
||||
test<32>();
|
||||
test<33>();
|
||||
test<34>();
|
||||
|
||||
test<35>();
|
||||
test<36>();
|
||||
test<37>();
|
||||
test<38>();
|
||||
test<39>();
|
||||
|
||||
test<40>();
|
||||
test<41>();
|
||||
test<42>();
|
||||
test<43>();
|
||||
test<44>();
|
||||
|
||||
test<45>();
|
||||
test<46>();
|
||||
test<47>();
|
||||
test<48>();
|
||||
test<49>();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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/include/fold.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
struct f
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
template<int n, int batch>
|
||||
int operator()(distinct<n, batch> const& d, int state) const
|
||||
{
|
||||
return state + n;
|
||||
}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
fusion::fold(v, 0, f());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
||||
@@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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/include/transform.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{
|
||||
static const int value = n;
|
||||
};
|
||||
|
||||
struct f
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
template<typename T>
|
||||
result_type operator()(T const& t) const
|
||||
{
|
||||
return T::value;
|
||||
}
|
||||
};
|
||||
|
||||
struct touch
|
||||
{
|
||||
template<typename T>
|
||||
void operator()(T const&) const
|
||||
{}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
// We're testing transform really
|
||||
// for_each call is to force iteration through the lazy
|
||||
// transform, otherwise very little will happen.
|
||||
fusion::for_each(fusion::transform(v, f()), touch());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
||||
@@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
||||
@@ -0,0 +1,59 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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/include/vector.hpp>
|
||||
#include <boost/fusion/include/intrinsic.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
typedef fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v_type;
|
||||
|
||||
v_type v;
|
||||
|
||||
fusion::at_c<0>(v);
|
||||
fusion::at_c<1>(v);
|
||||
fusion::at_c<2>(v);
|
||||
fusion::at_c<3>(v);
|
||||
fusion::at_c<4>(v);
|
||||
|
||||
fusion::at_c<5>(v);
|
||||
fusion::at_c<6>(v);
|
||||
fusion::at_c<7>(v);
|
||||
fusion::at_c<8>(v);
|
||||
fusion::at_c<9>(v);
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 0>::type va0;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 1>::type va1;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 2>::type va2;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 3>::type va3;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 4>::type va4;
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 5>::type va5;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 6>::type va6;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 7>::type va7;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 8>::type va8;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 9>::type va9;
|
||||
|
||||
fusion::begin(v);
|
||||
fusion::end(v);
|
||||
fusion::size(v);
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
||||
@@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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/include/vector.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
struct null_op
|
||||
{
|
||||
template<typename T>
|
||||
void operator()(T const& t) const
|
||||
{}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
fusion::for_each(v, null_op());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
||||
@@ -340,7 +340,7 @@ void result_type_tests()
|
||||
using boost::is_same;
|
||||
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (*)(), fusion::vector0 >::type, int
|
||||
fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
|
||||
>::value ));
|
||||
// disabled until boost::result_of supports it
|
||||
// BOOST_TEST(( is_same<
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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/functional/generation/make_unfused.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
using boost::ref;
|
||||
using boost::cref;
|
||||
|
||||
template <class Base = boost::blank, class RemoveNullary = mpl::false_>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq &) >
|
||||
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
boost::blank, mpl::identity<long> >::type
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template < typename Seq >
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value + elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T const & const_(T const & t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_unfused< test_func<> >::type unfused_func =
|
||||
fusion::make_unfused(f);
|
||||
|
||||
fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
test_func<noncopyable> > >::type unfused_func_ref =
|
||||
fusion::make_unfused(ref(f_nc));
|
||||
|
||||
fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
test_func<noncopyable> const> >::type unfused_func_c_ref =
|
||||
fusion::make_unfused(cref(f_nc));
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(const_(unfused_func)() == 0);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
|
||||
long expected;
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(const_(unfused_func)(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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/functional/adapter/unfused.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
|
||||
template <class Base = boost::blank>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq) >
|
||||
: mpl::identity<long>
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value + elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
void result_type_tests()
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
typedef fusion::unfused< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
result_type_tests();
|
||||
|
||||
test_func<noncopyable> f;
|
||||
fusion::unfused< test_func<> > unfused_func;
|
||||
fusion::unfused< test_func<noncopyable> & > unfused_func_ref(f);
|
||||
fusion::unfused< test_func<> const > unfused_func_c;
|
||||
fusion::unfused< test_func<> > const unfused_func_c2;
|
||||
fusion::unfused< test_func<noncopyable> const & > unfused_func_c_ref(f);
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c() == 0);
|
||||
BOOST_TEST(unfused_func_c2() == 0);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
|
||||
long expected;
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c2(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+5*sizeof(lv1) && lv2 == 3+5*sizeof(lv2) && lv3 == 7+5*sizeof(lv3));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
vector0 empty;
|
||||
vector0<> empty;
|
||||
std::cout << as_list(make_vector(1, 1.23, "harru")) << std::endl;
|
||||
std::cout << as_list(push_back(empty, 999)) << std::endl;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
vector0 empty;
|
||||
vector0<> empty;
|
||||
std::cout << as_map(make_list(make_pair<int>('X'), make_pair<double>("Men"))) << std::endl;
|
||||
std::cout << as_map(push_back(empty, make_pair<int>(999))) << std::endl;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
vector0 empty;
|
||||
vector0<> empty;
|
||||
std::cout << as_set(make_list(1, 1.23, "harru")) << std::endl;
|
||||
std::cout << as_set(push_back(empty, 999)) << std::endl;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ main()
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
vector0 empty;
|
||||
vector0<> empty;
|
||||
std::cout << as_vector(make_list(1, 1.23, "harru")) << std::endl;
|
||||
std::cout << as_vector(push_back(empty, 999)) << std::endl;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <boost/fusion/sequence/intrinsic/front.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/back.hpp>
|
||||
#include <boost/fusion/sequence/io/out.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/container/list/list.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
@@ -84,6 +85,16 @@ main()
|
||||
fusion::list<int, std::string> l(tuples::make_tuple(123, "Hola!!!"));
|
||||
l = tuples::make_tuple(123, "Hola!!!");
|
||||
}
|
||||
|
||||
{
|
||||
// test from Ticket #1601, submitted by Shunsuke Sogame
|
||||
// expanded by Stjepan Rajko
|
||||
boost::tuple<int, char> t(3, 'a');
|
||||
|
||||
BOOST_TEST(0u == fusion::distance(fusion::begin(t), fusion::begin(t)));
|
||||
BOOST_TEST(1u == fusion::distance(fusion::begin(t), fusion::next(fusion::begin(t))));
|
||||
BOOST_TEST(2u == fusion::distance(fusion::begin(t), fusion::end(t)));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ main()
|
||||
using namespace std;
|
||||
|
||||
{
|
||||
vector0 vec;
|
||||
vector0<> vec;
|
||||
(void) vec;
|
||||
cout << "(): " << sizeof(vec) << endl;
|
||||
cout << (boost::is_empty<vector0>::value ? "is empty" : "is not empty") << endl;
|
||||
cout << (boost::is_empty<vector0<> >::value ? "is empty" : "is not empty") << endl;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -207,7 +207,7 @@ main()
|
||||
|
||||
{
|
||||
// testing copy and assign from a view
|
||||
vector0 empty;
|
||||
vector0<> empty;
|
||||
fusion::vector2<int, long> v(fusion::push_back(fusion::push_back(empty, 123), 456));
|
||||
BOOST_TEST(at_c<0>(v) == 123);
|
||||
BOOST_TEST(at_c<1>(v) == 456);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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/detail/lightweight_test.hpp>
|
||||
@@ -58,8 +58,8 @@ int main()
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<boost::fusion::result_of::begin<view>::type, boost::fusion::result_of::end<view>::type>::value == 2));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector<int,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector<int,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector2<int,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector2<int,char> >));
|
||||
}
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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/detail/lightweight_test.hpp>
|
||||
@@ -57,8 +57,8 @@ int main()
|
||||
BOOST_TEST(distance(begin(v), end(v)) == 2);
|
||||
BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<boost::fusion::result_of::begin<view>::type, boost::fusion::result_of::end<view>::type>::value == 2));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector<int,char,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector<int,char,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector3<int,char,char> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector3<int,char,char> >));
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in new issue
Block a user