Quickbook: Copy trunk libs into quickbook-dev branch.

[SVN r75213]
This commit is contained in:
Daniel James committed 2011-11-01 13:04:29 +00:00
commit 6466de2568
188 files changed
+1475 -888

No files matched your search

+9 -10
View File
@@ -92,7 +92,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -111,8 +110,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -149,7 +148,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}
@@ -167,8 +166,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point_with_private_members>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point_with_private_members>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point_with_private_members>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -178,22 +177,22 @@ main()
{
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point>::type,
boost::fusion::result_of::front<ns::point>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,0,false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point>::type::type,
boost::fusion::result_of::front<ns::point>::type::type,
int
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point const>::type,
boost::fusion::result_of::front<ns::point const>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,0,true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point const>::type::type,
boost::fusion::result_of::front<ns::point const>::type::type,
int
>));
}
+3 -4
View File
@@ -64,7 +64,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -84,8 +83,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -128,7 +127,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<adapted::point,0>::type
boost::fusion::result_of::value_at_c<adapted::point,0>::type
, mpl::front<adapted::point>::type>));
}
+7 -8
View File
@@ -55,7 +55,6 @@ int
main()
{
using namespace boost::fusion;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -74,8 +73,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -118,12 +117,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p(5, 3);
+7 -8
View File
@@ -56,7 +56,6 @@ int
main()
{
using namespace boost::fusion;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -76,8 +75,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -123,12 +122,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
ns::point basep(5, 3);
adapted::point p(basep);
+8 -9
View File
@@ -61,7 +61,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -80,8 +79,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -117,12 +116,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((mpl::not_<fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p = {5, 3};
@@ -133,7 +132,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}
+7 -7
View File
@@ -61,8 +61,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -102,12 +102,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
ns::point basep = {5, 3};
adapted::point p(basep);
+7 -8
View File
@@ -57,7 +57,6 @@ int
main()
{
using namespace boost::fusion;
using namespace std;
typedef ns::point<int,int> point;
@@ -78,8 +77,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -122,12 +121,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p(5, 3);
+7 -7
View File
@@ -78,8 +78,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -115,12 +115,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p = {5, 3};
+6 -7
View File
@@ -78,7 +78,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -97,8 +96,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -136,16 +135,16 @@ main()
using namespace boost::fusion;
using boost::is_same;
typedef result_of::begin<s>::type b;
typedef result_of::end<s>::type e;
typedef boost::fusion::result_of::begin<s>::type b;
typedef boost::fusion::result_of::end<s>::type e;
// this fails
BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
}
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}
+6 -7
View File
@@ -56,7 +56,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -76,8 +75,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -119,17 +118,17 @@ main()
using namespace boost::fusion;
using boost::is_same;
typedef result_of::begin<ns1::s1>::type b;
typedef result_of::end<ns1::s1>::type e;
typedef boost::fusion::result_of::begin<ns1::s1>::type b;
typedef boost::fusion::result_of::end<ns1::s1>::type e;
// this fails
BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
}
{
BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<adapted::point,0>::type
boost::fusion::result_of::value_at_c<adapted::point,0>::type
, mpl::front<adapted::point>::type>));
}
+2 -3
View File
@@ -65,7 +65,6 @@ int
main()
{
using namespace boost::fusion;
using namespace std;
typedef ns::point<int, int> point;
@@ -86,8 +85,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
+5 -5
View File
@@ -73,8 +73,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -111,10 +111,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s<int> >::type b;
typedef result_of::end<s<int> >::type e;
typedef boost::fusion::result_of::begin<s<int> >::type b;
typedef boost::fusion::result_of::end<s<int> >::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}
return boost::report_errors();
+18 -18
View File
@@ -82,65 +82,65 @@ int main()
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::name>::type,
boost::fusion::result_of::value_at_key<et, keys::name>::type,
std::string
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::name>::type,
fusion::result_of::value_at_c<et, 0>::type
boost::fusion::result_of::value_at_key<et, keys::name>::type,
boost::fusion::result_of::value_at_c<et, 0>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::age>::type,
boost::fusion::result_of::value_at_key<et, keys::age>::type,
int
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::age>::type,
fusion::result_of::value_at_c<et, 1>::type
boost::fusion::result_of::value_at_key<et, keys::age>::type,
boost::fusion::result_of::value_at_c<et, 1>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::name>::type,
boost::fusion::result_of::at_key<et, keys::name>::type,
fusion::extension::adt_attribute_proxy<et, 0, false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::age>::type,
boost::fusion::result_of::at_key<et, keys::age>::type,
fusion::extension::adt_attribute_proxy<et, 1, false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::name>::type,
fusion::result_of::front<et>::type
boost::fusion::result_of::at_key<et, keys::name>::type,
boost::fusion::result_of::front<et>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::age>::type,
fusion::result_of::back<et>::type
boost::fusion::result_of::at_key<et, keys::age>::type,
boost::fusion::result_of::back<et>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::name>::type,
boost::fusion::result_of::at_key<etc, keys::name>::type,
fusion::extension::adt_attribute_proxy<et, 0, true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::age>::type,
boost::fusion::result_of::at_key<etc, keys::age>::type,
fusion::extension::adt_attribute_proxy<et, 1, true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::name>::type,
fusion::result_of::front<etc>::type
boost::fusion::result_of::at_key<etc, keys::name>::type,
boost::fusion::result_of::front<etc>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::age>::type,
fusion::result_of::back<etc>::type
boost::fusion::result_of::at_key<etc, keys::age>::type,
boost::fusion::result_of::back<etc>::type
>));
BOOST_MPL_ASSERT((
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+2 -2
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -36,7 +36,7 @@ main()
{
typedef pair<int, char> p1;
typedef pair<double, std::string> p2;
result_of::as_map<list<p1, p2> >::type map(make_pair<int>('X'), make_pair<double>("Men"));
boost::fusion::result_of::as_map<list<p1, p2> >::type map(make_pair<int>('X'), make_pair<double>("Men"));
std::cout << at_key<int>(map) << std::endl;
std::cout << at_key<double>(map) << std::endl;
BOOST_TEST(at_key<int>(map) == 'X');
+2 -2
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -40,7 +40,7 @@ main()
}
{
result_of::as_set<list<int, double, std::string> >::type set(1, 1.23, "harru");
boost::fusion::result_of::as_set<list<int, double, std::string> >::type set(1, 1.23, "harru");
std::cout << at_key<int>(set) << std::endl;
BOOST_TEST(at_key<int>(set) == 1);
}
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
+3 -4
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -37,7 +37,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -57,8 +56,8 @@ main()
at_c<1>(t) = "mama mia";
BOOST_TEST(t == make_vector(6, "mama mia"));
BOOST_STATIC_ASSERT(result_of::size<tuple_type>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<tuple_type>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<tuple_type>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<tuple_type>::value);
BOOST_TEST(front(t) == 6);
}
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+7 -7
View File
@@ -51,8 +51,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -88,12 +88,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p(5, 3);
+7 -7
View File
@@ -55,8 +55,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -92,12 +92,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p(5, 3);
+5 -5
View File
@@ -48,8 +48,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -86,10 +86,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s>::type b;
typedef result_of::end<s>::type e;
typedef boost::fusion::result_of::begin<s>::type b;
typedef boost::fusion::result_of::end<s>::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}
{
+5 -5
View File
@@ -51,8 +51,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@@ -89,10 +89,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s<int> >::type b;
typedef result_of::end<s<int> >::type e;
typedef boost::fusion::result_of::begin<s<int> >::type b;
typedef boost::fusion::result_of::end<s<int> >::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+8 -8
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -77,7 +77,7 @@ main()
filter_view_type view(v);
std::cout << view << std::endl;
BOOST_TEST((view == make_vector('@', 987654, true, 6.6)));
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
}
//cschmidt: This is illegal C++. ADL instantiates less<_, int_<3> > - which
@@ -94,7 +94,7 @@ main()
filter_view_type view(v);
std::cout << view << std::endl;
BOOST_TEST((view == make_vector(1, 2, 0, -1)));
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
#endif
}*/
@@ -104,7 +104,7 @@ main()
typedef vector<int> vec;
typedef filter_view<vec, reject_all> filter_view_type;
BOOST_MPL_ASSERT((result_of::equal_to<result_of::begin<filter_view_type>::type, result_of::end<filter_view_type>::type>));
BOOST_MPL_ASSERT((boost::fusion::result_of::equal_to<boost::fusion::result_of::begin<filter_view_type>::type, boost::fusion::result_of::end<filter_view_type>::type>));
}
{
@@ -114,11 +114,11 @@ main()
typedef filter_view<map_type const, is_same<_, pair<double, std::string> > > filter_view_type;
filter_view_type f(m);
BOOST_MPL_ASSERT((result_of::has_key<filter_view_type, double>::type));
BOOST_MPL_ASSERT_NOT((result_of::has_key<filter_view_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<filter_view_type, double>::type));
BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::has_key<filter_view_type, void>::type));
BOOST_MPL_ASSERT((is_same<result_of::key_of<result_of::begin<filter_view_type>::type>::type, double>));
BOOST_MPL_ASSERT((is_same<result_of::value_of_data<result_of::begin<filter_view_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<filter_view_type>::type>::type, double>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<filter_view_type>::type>::type, std::string>));
std::cout << deref_data(begin(f)) << std::endl;
BOOST_TEST((deref_data(begin(f)) == "Bond"));
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+31 -31
View File
@@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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 <string>
@@ -30,7 +30,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type v(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(v);
boost::fusion::result_of::begin<seq_type>::type i(v);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@@ -62,7 +62,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> const seq_type;
seq_type t(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(t);
boost::fusion::result_of::begin<seq_type>::type i(t);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@@ -80,22 +80,22 @@ void test()
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
typedef FUSION_SEQUENCE<int, char, double, char const*> const cseq_type;
typedef result_of::begin<seq_type>::type vi1;
typedef result_of::begin<cseq_type>::type vi2;
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi1>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi1 const>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi2>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi2>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi2 const>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi2 const>::value));
typedef boost::fusion::result_of::begin<seq_type>::type vi1;
typedef boost::fusion::result_of::begin<cseq_type>::type vi2;
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi1>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi1 const>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2 const>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2 const>::value));
}
{
typedef FUSION_SEQUENCE<int, int> seq_type;
typedef result_of::begin<seq_type>::type begin_type;
typedef result_of::end<seq_type>::type end_type;
typedef result_of::next<begin_type>::type i1;
typedef result_of::next<i1>::type i2;
typedef boost::fusion::result_of::begin<seq_type>::type begin_type;
typedef boost::fusion::result_of::end<seq_type>::type end_type;
typedef boost::fusion::result_of::next<begin_type>::type i1;
typedef boost::fusion::result_of::next<i1>::type i2;
BOOST_STATIC_ASSERT((is_same<end_type, i2>::value));
}
@@ -105,7 +105,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type t(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(t);
boost::fusion::result_of::begin<seq_type>::type i(t);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@@ -113,7 +113,7 @@ void test()
BOOST_TEST(*next(next(next(i))) == s);
next(next(next(next(i)))); // end
#ifdef FUSION_TEST_FAIL
next(next(next(next(next(i))))); // past the end: must not compile
#endif
@@ -138,34 +138,34 @@ void test()
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type t(1, 'x', 3.3, "Hello");
BOOST_STATIC_ASSERT((result_of::distance<
result_of::begin<seq_type>::type
, result_of::end<seq_type>::type >::value == 4));
BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<
boost::fusion::result_of::begin<seq_type>::type
, boost::fusion::result_of::end<seq_type>::type >::value == 4));
BOOST_TEST(distance(begin(t), end(t)).value == 4);
}
{ // Testing tuple iterator result_of::value_of, result_of::deref, result_of::value_at
{ // Testing tuple iterator boost::fusion::result_of::value_of, boost::fusion::result_of::deref, boost::fusion::result_of::value_at
typedef FUSION_SEQUENCE<int, char&> seq_type;
typedef result_of::begin<seq_type>::type i0;
typedef result_of::next<i0>::type i1;
typedef result_of::next<result_of::begin<const seq_type>::type>::type i2;
typedef boost::fusion::result_of::begin<seq_type>::type i0;
typedef boost::fusion::result_of::next<i0>::type i1;
typedef boost::fusion::result_of::next<boost::fusion::result_of::begin<const seq_type>::type>::type i2;
BOOST_STATIC_ASSERT((
is_same<result_of::value_at_c<seq_type, 0>::type, int>::value));
is_same<boost::fusion::result_of::value_at_c<seq_type, 0>::type, int>::value));
BOOST_STATIC_ASSERT((
is_same<result_of::value_at_c<seq_type, 1>::type, char&>::value));
is_same<boost::fusion::result_of::value_at_c<seq_type, 1>::type, char&>::value));
BOOST_STATIC_ASSERT((
is_same<traits::category_of<i0>::type, FUSION_TRAVERSAL_TAG>::value));
BOOST_STATIC_ASSERT((is_same<result_of::deref<i0>::type, int&>::value));
BOOST_STATIC_ASSERT((is_same<result_of::deref<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i0>::type, int&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<result_of::value_of<i0>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of::value_of<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i0>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i1>::type, char&>::value));
}
{ // Testing advance
+12 -12
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -50,7 +50,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector('x', 3.3)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
@@ -64,7 +64,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST(slice == make_vector());
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 0);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
}
}
@@ -82,7 +82,7 @@ main()
slice_t slice(f, l);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector(3, 4)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
@@ -90,19 +90,19 @@ main()
map_type m(make_pair<void>("foo"), make_pair<double>('x'), make_pair<void*>(2));
typedef iterator_range<
result_of::begin<map_type>::type
, result_of::advance_c<result_of::begin<map_type>::type,2>::type
boost::fusion::result_of::begin<map_type>::type
, boost::fusion::result_of::advance_c<boost::fusion::result_of::begin<map_type>::type,2>::type
> range_type;
range_type r(begin(m), advance_c<2>(begin(m)));
BOOST_MPL_ASSERT((result_of::has_key<range_type, void>::type));
BOOST_MPL_ASSERT((result_of::has_key<range_type, double>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, double>::type));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::begin<range_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<range_type>::type>::type>::type, double>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<range_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, double>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<range_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<range_type>::type>::type>::type, char>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<range_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, char>));
std::cout << deref_data(begin(r)) << std::endl;
std::cout << deref_data(fusion::next(begin(r))) << std::endl;
+10 -10
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -159,20 +159,20 @@ main()
typedef joint_view<map_type, set_type> joint_view_type;
joint_view_type j(m,s);
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, void>::type));
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, std::string>::type));
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, float>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, std::string>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, float>::type));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::begin<joint_view_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<joint_view_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<
result_of::key_of<result_of::next<result_of::next<result_of::begin<joint_view_type>::type>::type>::type>::type
boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
, float>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<joint_view_type>::type>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<joint_view_type>::type>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<
result_of::value_of_data<result_of::next<result_of::next<result_of::begin<joint_view_type>::type>::type>::type>::type
boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
, float>));
std::cout << deref_data(begin(j)) << std::endl;
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+55 -18
View File
@@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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>
@@ -20,6 +20,8 @@
#include <boost/fusion/support/category_of.hpp>
#include <boost/static_assert.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/typeof/typeof.hpp>
#include <iostream>
#include <string>
@@ -28,7 +30,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
namespace fusion = boost::fusion;
using boost::fusion::pair;
using boost::fusion::make_pair;
@@ -40,31 +41,32 @@ main()
{
typedef map<
pair<int, char>
, pair<double, std::string> >
, pair<double, std::string> >
map_type;
BOOST_MPL_ASSERT((traits::is_associative<map_type>));
BOOST_MPL_ASSERT((traits::is_random_access<map_type>));
map_type m(
make_pair<int>('X')
, make_pair<double>("Men"));
std::cout << at_key<int>(m) << std::endl;
std::cout << at_key<double>(m) << std::endl;
BOOST_TEST(at_key<int>(m) == 'X');
BOOST_TEST(at_key<double>(m) == "Men");
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<map_type, int>::type, char>::value));
boost::is_same<boost::fusion::result_of::value_at_key<map_type, int>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<map_type, double>::type, std::string>::value));
boost::is_same<boost::fusion::result_of::value_at_key<map_type, double>::type, std::string>::value));
std::cout << m << std::endl;
BOOST_STATIC_ASSERT((result_of::has_key<map_type, int>::value));
BOOST_STATIC_ASSERT((result_of::has_key<map_type, double>::value));
BOOST_STATIC_ASSERT((!result_of::has_key<map_type, std::string>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, double>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<map_type, std::string>::value));
std::cout << deref_data(begin(m)) << std::endl;
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
@@ -72,12 +74,47 @@ main()
BOOST_TEST(deref_data(begin(m)) == 'X');
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Men");
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<map_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<map_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<map_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<map_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<map_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<map_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, std::string>::value));
//! Test random access interface.
pair<int, char> a = at_c<0>(m);
pair<double, std::string> b = at_c<1>(m);
}
//! iterators & random access interface.
{
typedef pair<boost::mpl::int_<0>, std::string> pair0;
typedef pair<boost::mpl::int_<1>, std::string> pair1;
typedef pair<boost::mpl::int_<2>, std::string> pair2;
typedef pair<boost::mpl::int_<3>, std::string> pair3;
typedef pair<boost::mpl::int_<4>, std::string> pair4;
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
BOOST_AUTO( it0, begin(m) );
BOOST_TEST((deref(it0) == pair0("zero")));
BOOST_AUTO( it1, fusion::next(it0) );
BOOST_TEST((deref(it1) == pair1("one")));
BOOST_AUTO( it2, fusion::next(it1) );
BOOST_TEST((deref(it2) == pair2("two")));
BOOST_AUTO( it3, fusion::next(it2) );
BOOST_TEST((deref(it3) == pair3("three")));
BOOST_AUTO( it4, fusion::next(it3) );
BOOST_TEST((deref(it4) == pair4("four")));
BOOST_TEST((deref(fusion::advance_c<4>(it0)) == deref(it4)));
//! Bi-directional
BOOST_TEST((deref(fusion::prior(it4)) == deref(it3) ));
BOOST_TEST((deref(fusion::prior(it3)) == deref(it2) ));
BOOST_TEST((deref(fusion::prior(it2)) == deref(it1) ));
BOOST_TEST((deref(fusion::prior(it1)) == deref(it0) ));
}
{
std::cout << make_map<char, int>('X', 123) << std::endl;
BOOST_TEST(at_key<char>(make_map<char, int>('X', 123)) == 'X');
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+4 -4
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (C) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -21,7 +21,7 @@
#endif
#if !defined(FUSION_SIZE)
#define FUSION_SIZE result_of::size
#define FUSION_SIZE boost::fusion::result_of::size
#endif
template <typename S1, typename S2>
@@ -144,8 +144,8 @@ test()
BOOST_STATIC_ASSERT(FUSION_SIZE<t1>::value == 3);
BOOST_STATIC_ASSERT(FUSION_SIZE<t2>::value == 0);
BOOST_STATIC_ASSERT(!result_of::empty<t1>::value);
BOOST_STATIC_ASSERT(result_of::empty<t2>::value);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<t1>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<t2>::value);
}
{ // testing front & back
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+29 -7
View File
@@ -1,11 +1,12 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
@@ -54,9 +55,9 @@ main()
std::cout << rev << std::endl;
BOOST_TEST((rev == make_vector(s, 123456789, 'x', 123)));
typedef result_of::begin<view_type>::type first_type;
typedef boost::fusion::result_of::begin<view_type>::type first_type;
first_type first_it(begin(rev));
typedef result_of::next<first_type>::type second_type;
typedef boost::fusion::result_of::next<first_type>::type second_type;
second_type second_it(next(first_it));
BOOST_TEST((*second_it == 123456789));
BOOST_TEST((*prior(second_it) == s));
@@ -69,19 +70,40 @@ main()
BOOST_TEST((at_c<3>(rev)==123));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,0>::type,char const*>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,0>::type,char const*>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,1>::type,long>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,1>::type,long>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,2>::type,char>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,2>::type,char>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,3>::type,int>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,3>::type,int>
));
}
//! Map
{
typedef pair<boost::mpl::int_<0>, std::string> pair0;
typedef pair<boost::mpl::int_<1>, std::string> pair1;
typedef pair<boost::mpl::int_<2>, std::string> pair2;
typedef pair<boost::mpl::int_<3>, std::string> pair3;
typedef pair<boost::mpl::int_<4>, std::string> pair4;
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
typedef reverse_view<map_type> view_type;
view_type rev(m);
std::cout << rev << std::endl;
BOOST_TEST((rev == make_vector( pair4("four"), pair3("three"), pair2("two"), pair1("one"), pair0("zero"))));
BOOST_TEST((at_c<0>(rev) == pair4("four")));
BOOST_TEST((at_c<1>(rev) == pair3("three")));
BOOST_TEST((at_c<2>(rev) == pair2("two")));
BOOST_TEST((at_c<3>(rev) == pair1("one")));
BOOST_TEST((at_c<4>(rev) == pair0("zero")));
}
return boost::report_errors();
}
+146
View File
@@ -0,0 +1,146 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2011 Eric Niebler
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 <sstream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/sequence/comparison/equal_to.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
#include <boost/static_assert.hpp>
#include "tree.hpp"
struct ostream_fun
{
ostream_fun(std::ostream &sout)
: sout_(sout)
{}
template<typename T>
void operator ()(T const &t) const
{
sout_ << t << ' ';
}
private:
std::ostream & sout_;
};
template<typename Tree>
void
process_tree(Tree const &tree)
{
using namespace boost;
using namespace fusion;
using mpl::_;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
typedef iterator_range<short_iter, float_iter> slice_t;
BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);
// find_if of a segmented data structure returns generic
// segmented iterators
short_iter si = find_if<is_same<_,short> >(tree);
float_iter fi = find_if<is_same<_,float> >(tree);
// If you put them in an iterator range, the range
// is automatically a segmented data structure.
slice_t slice(si, fi);
std::stringstream sout;
fusion::for_each(slice, ostream_fun(sout));
BOOST_TEST((sout.str() == "100 e f 0 B "));
}
int
main()
{
using namespace boost::fusion;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
std::cout << tuple_delimiter(", ");
{
char const* s = "Ruby";
typedef vector<int, char, double, char const*> vector_type;
vector_type vec(1, 'x', 3.3, s);
{
typedef vector_iterator<vector_type, 1> i1t;
typedef vector_iterator<vector_type, 3> i3t;
i1t i1(vec);
i3t i3(vec);
typedef iterator_range<i1t, i3t> slice_t;
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector('x', 3.3)));
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
typedef vector_iterator<vector_type, 0> i1t;
typedef vector_iterator<vector_type, 0> i3t;
i1t i1(vec);
i3t i3(vec);
typedef iterator_range<i1t, i3t> slice_t;
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST(slice == make_vector());
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
}
}
{
typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
typedef boost::mpl::begin<mpl_vec>::type it0;
typedef boost::mpl::next<it0>::type it1;
typedef boost::mpl::next<it1>::type it2;
typedef boost::mpl::next<it2>::type it3;
it1 f;
it3 l;
typedef iterator_range<it1, it3> slice_t;
slice_t slice(f, l);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector(3, 4)));
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
process_tree(
make_tree(
make_vector(double(0),'B')
, make_tree(
make_vector(1,2,long(3))
, make_tree(make_vector('a','b','c'))
, make_tree(make_vector(short('d'),'e','f'))
)
, make_tree(
make_vector(4,5,6)
, make_tree(make_vector(float(1),'h','i'))
, make_tree(make_vector('j','k','l'))
)
)
);
}
return boost::report_errors();
}
+10 -11
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -28,7 +28,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
namespace fusion = boost::fusion;
using boost::fusion::pair;
using boost::fusion::make_pair;
@@ -51,15 +50,15 @@ main()
BOOST_TEST(at_key<std::string>(m) == "Hola");
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<set_type, int>::type, int>::value));
boost::is_same<boost::fusion::result_of::value_at_key<set_type, int>::type, int>::value));
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<set_type, std::string>::type, std::string>::value));
boost::is_same<boost::fusion::result_of::value_at_key<set_type, std::string>::type, std::string>::value));
std::cout << m << std::endl;
BOOST_STATIC_ASSERT((result_of::has_key<set_type, int>::value));
BOOST_STATIC_ASSERT((result_of::has_key<set_type, std::string>::value));
BOOST_STATIC_ASSERT((!result_of::has_key<set_type, double>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, std::string>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<set_type, double>::value));
std::cout << deref_data(begin(m)) << std::endl;
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
@@ -67,10 +66,10 @@ main()
BOOST_TEST(deref_data(begin(m)) == 123);
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Hola");
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
}
{
+37 -1
View File
@@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2011 Eric Niebler
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)
@@ -7,8 +8,22 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/view/single_view/single_view.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/front.hpp>
#include <boost/fusion/sequence/intrinsic/back.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
struct X {};
@@ -40,7 +55,28 @@ main()
#endif
std::cout << view1 << std::endl;
BOOST_TEST(*begin(view1) == 3);
BOOST_TEST(at<boost::mpl::int_<0> >(view1) == 3);
BOOST_TEST(view1.val == 3);
BOOST_TEST(3 == front(view1));
BOOST_TEST(3 == back(view1));
BOOST_TEST(!empty(view1));
BOOST_TEST(next(begin(view1)) == end(view1));
BOOST_TEST(prior(end(view1)) == begin(view1));
BOOST_TEST(!(next(begin(view1)) != end(view1)));
BOOST_TEST(!(prior(end(view1)) != begin(view1)));
BOOST_TEST(1 == distance(begin(view1), end(view1)));
BOOST_TEST(0 == distance(end(view1), end(view1)));
BOOST_TEST(0 == distance(begin(view1), begin(view1)));
BOOST_TEST(end(view1) == advance<boost::mpl::int_<1> >(begin(view1)));
BOOST_TEST(begin(view1) == advance<boost::mpl::int_<0> >(begin(view1)));
BOOST_TEST(end(view1) == advance<boost::mpl::int_<0> >(end(view1)));
BOOST_TEST(begin(view1) == advance<boost::mpl::int_<-1> >(end(view1)));
BOOST_TEST(end(view1) == advance_c<1>(begin(view1)));
BOOST_TEST(begin(view1) == advance_c<0>(begin(view1)));
BOOST_TEST(end(view1) == advance_c<0>(end(view1)));
BOOST_TEST(begin(view1) == advance_c<-1>(end(view1)));
BOOST_TEST(1 == size(view1));
BOOST_MPL_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at<single_view<int>, boost::mpl::int_<0> >::type>));
single_view<X> view2;
std::cout << view2 << std::endl;
+3 -4
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -36,7 +36,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -56,8 +55,8 @@ main()
at_c<1>(p) = "mama mia";
BOOST_TEST(p == make_vector(6, "mama mia"));
BOOST_STATIC_ASSERT(result_of::size<pair_type>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<pair_type>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<pair_type>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<pair_type>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == "mama mia");
+35
View File
@@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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/config.hpp>
// The std_tuple_iterator adaptor only supports implementations
// using variadic templates
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
#include <boost/fusion/adapted/std_tuple.hpp>
#define FUSION_SEQUENCE std::tuple
#define FUSION_TRAVERSAL_TAG random_access_traversal_tag
#include "./iterator.hpp"
int
main()
{
test();
return boost::report_errors();
}
#else
int
main()
{
return 0;
}
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -22,7 +22,7 @@ int main()
namespace fusion = boost::fusion;
{
typedef fusion::vector<std::vector<int>, char> test_vector;
BOOST_MPL_ASSERT((boost::is_same<void, fusion::result_of::swap<test_vector, test_vector>::type>));
BOOST_MPL_ASSERT((boost::is_same<void, boost::fusion::result_of::swap<test_vector, test_vector>::type>));
test_vector v1(std::vector<int>(1, 101), 'a'), v2(std::vector<int>(1, 202), 'b');
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+100
View File
@@ -0,0 +1,100 @@
/*=============================================================================
Copyright (c) 2006 Eric Niebler
Use, modification and distribution is 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)
==============================================================================*/
#ifndef FUSION_BINARY_TREE_EAN_05032006_1027
#define FUSION_BINARY_TREE_EAN_05032006_1027
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/view/single_view.hpp>
#include <boost/fusion/container/list/cons.hpp> // for nil
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
namespace boost { namespace fusion
{
struct tree_tag;
template <typename Data, typename Left = nil, typename Right = nil>
struct tree
: sequence_base<tree<Data, Left, Right> >
{
typedef Data data_type;
typedef Left left_type;
typedef Right right_type;
typedef tree_tag fusion_tag;
typedef forward_traversal_tag category;
typedef mpl::false_ is_view;
typedef typename mpl::if_<
traits::is_sequence<Data>
, Data
, single_view<Data>
>::type data_view;
explicit tree(
typename fusion::detail::call_param<Data>::type data_
, typename fusion::detail::call_param<Left>::type left_ = Left()
, typename fusion::detail::call_param<Right>::type right_ = Right()
)
: segments(left_, data_view(data_), right_)
{}
typedef vector3<Left, data_view, Right> segments_type;
segments_type segments;
};
template <typename Data>
tree<Data> make_tree(Data const &data)
{
return tree<Data>(data);
}
template <typename Data, typename Left, typename Right>
tree<Data, Left, Right> make_tree(Data const &data, Left const &left, Right const &right)
{
return tree<Data, Left, Right>(data, left, right);
}
namespace extension
{
template <>
struct is_segmented_impl<tree_tag>
{
template <typename Sequence>
struct apply : mpl::true_ {};
};
template <>
struct segments_impl<tree_tag>
{
template <typename Sequence>
struct apply
{
typedef typename mpl::if_<
is_const<Sequence>
, typename Sequence::segments_type const &
, typename Sequence::segments_type &
>::type type;
static type call(Sequence &seq)
{
return seq.segments;
}
};
};
}
}}
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+4 -4
View File
@@ -1,15 +1,15 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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/fusion/tuple.hpp>
#define FUSION_SEQUENCE tuple
#define FUSION_SEQUENCE boost::fusion::tuple
#define FUSION_AT get
#define FUSION_MAKE make_tuple
#define FUSION_MAKE boost::fusion::make_tuple
#include "make.hpp"
int
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+2 -2
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -16,7 +16,7 @@
#endif
#if !defined(FUSION_VALUE_AT)
#define FUSION_VALUE_AT(S, N) result_of::value_at_c<S, N>
#define FUSION_VALUE_AT(S, N) boost::fusion::result_of::value_at_c<S, N>
#endif
namespace test_detail
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+2 -2
View File
@@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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/fusion/container/vector/vector.hpp>
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+30 -31
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
@@ -30,22 +30,21 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
{
vector0<> vec;
(void) vec;
cout << "(): " << sizeof(vec) << endl;
cout << (boost::is_empty<vector0<> >::value ? "is empty" : "is not empty") << endl;
std::cout << "(): " << sizeof(vec) << std::endl;
std::cout << (boost::is_empty<vector0<> >::value ? "is empty" : "is not empty") << std::endl;
}
{
typedef vector1<int> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 1);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 1);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
// prove that it is mutable
at_c<0>(vec) = 987;
@@ -56,7 +55,7 @@ main()
typedef vector1<int> type;
type vec(123);
BOOST_TEST(at_c<0>(vec) == 123);
cout << "(int): " << sizeof(vec) << endl;
std::cout << "(int): " << sizeof(vec) << std::endl;
}
{ // testing const vector
@@ -77,13 +76,13 @@ main()
{
typedef vector2<int, char> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 2);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_TEST(at_c<1>(vec) == char());
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
}
{
@@ -91,7 +90,7 @@ main()
type vec(123, 'x');
BOOST_TEST(at_c<0>(vec) == 123);
BOOST_TEST(at_c<1>(vec) == 'x');
cout << "(int, char): " << sizeof(vec) << endl;
std::cout << "(int, char): " << sizeof(vec) << std::endl;
}
{
@@ -103,15 +102,15 @@ main()
{
typedef vector3<int, char, double> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 3);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 3);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_TEST(at_c<1>(vec) == char());
BOOST_TEST(at_c<2>(vec) == double());
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
}
{
@@ -120,19 +119,19 @@ main()
BOOST_TEST(at_c<0>(vec) == 123);
BOOST_TEST(at_c<1>(vec) == 'x');
BOOST_TEST(at_c<2>(vec) >= 123.455 && at_c<2>(vec) <= 123.457);
cout << "(int, char, double): " << sizeof(vec) << endl;
std::cout << "(int, char, double): " << sizeof(vec) << std::endl;
}
{
typedef vector4<int, char, double, bool> type;
type vec(123, 'x', 123.456, true);
cout << "(int, char, double, bool): " << sizeof(vec) << endl;
std::cout << "(int, char, double, bool): " << sizeof(vec) << std::endl;
}
{
typedef vector4<int, char, bool, double> type;
type vec(123, 'x', true, 123.456);
cout << "(int, char, bool, double): " << sizeof(vec) << endl;
std::cout << "(int, char, bool, double): " << sizeof(vec) << std::endl;
}
{
@@ -147,20 +146,20 @@ main()
BOOST_TEST(at_c<5>(vec) >= 5.9 && at_c<5>(vec) <= 6.1);
BOOST_TEST(at_c<6>(vec) >= 6.9 && at_c<6>(vec) <= 7.1);
BOOST_STATIC_ASSERT((boost::is_same<bool, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<short, result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 3>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<long, result_of::value_at_c<type, 4>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<float, result_of::value_at_c<type, 5>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, result_of::value_at_c<type, 6>::type>::value));
cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << endl;
BOOST_STATIC_ASSERT((boost::is_same<bool, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<short, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 3>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<long, boost::fusion::result_of::value_at_c<type, 4>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<float, boost::fusion::result_of::value_at_c<type, 5>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 6>::type>::value));
std::cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << std::endl;
}
{
typedef vector10<int, int, int, int, int, int, int, int, int, int> type;
type vec; // compile check only
cout << "vector10 of int: " << sizeof(vec) << endl;
std::cout << "vector10 of int: " << sizeof(vec) << std::endl;
}
{
@@ -169,7 +168,7 @@ main()
, int, int, int, int, int, int, int, int, int, int> type;
type vec; // compile check only
cout << "vector20 of int: " << sizeof(vec) << endl;
std::cout << "vector20 of int: " << sizeof(vec) << std::endl;
}
{
@@ -179,7 +178,7 @@ main()
, int, int, int, int, int, int, int, int, int, int> type;
type vec; // compile check only
cout << "vector30 of int: " << sizeof(vec) << endl;
std::cout << "vector30 of int: " << sizeof(vec) << std::endl;
}
{
@@ -190,7 +189,7 @@ main()
, int, int, int, int, int, int, int, int, int, int> type;
type vec; // compile check only
cout << "vector40 of int: " << sizeof(vec) << endl;
std::cout << "vector40 of int: " << sizeof(vec) << std::endl;
}
{
@@ -202,7 +201,7 @@ main()
, int, int, int, int, int, int, int, int, int, int> type;
type vec; // compile check only
cout << "vector50 of int: " << sizeof(vec) << endl;
std::cout << "vector50 of int: " << sizeof(vec) << std::endl;
}
{
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,6 +1,6 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
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)
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+1 -1
View File
@@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
+7 -7
View File
@@ -34,19 +34,19 @@ int main()
BOOST_TEST(at_c<0>(back(v)) == 2);
BOOST_TEST(at_c<2>(back(v)) == 'b');
typedef result_of::begin<view>::type first_iterator;
typedef result_of::value_of<first_iterator>::type first_element;
typedef boost::fusion::result_of::begin<view>::type first_iterator;
typedef boost::fusion::result_of::value_of<first_iterator>::type first_element;
typedef result_of::at_c<first_element, 0>::type e0;
typedef result_of::at_c<first_element, 2>::type e2;
typedef boost::fusion::result_of::at_c<first_element, 0>::type e0;
typedef boost::fusion::result_of::at_c<first_element, 2>::type e2;
BOOST_MPL_ASSERT((boost::is_same<e0, int&>));
BOOST_MPL_ASSERT((boost::is_same<e2, char&>));
BOOST_TEST(size(front(v)) == 3);
typedef result_of::value_at_c<view, 0>::type first_value_at;
typedef result_of::value_at_c<first_value_at, 0>::type v0;
typedef result_of::value_at_c<first_value_at, 2>::type v2;
typedef boost::fusion::result_of::value_at_c<view, 0>::type first_value_at;
typedef boost::fusion::result_of::value_at_c<first_value_at, 0>::type v0;
typedef boost::fusion::result_of::value_at_c<first_value_at, 2>::type v2;
BOOST_MPL_ASSERT((boost::is_same<v0, int>));
BOOST_MPL_ASSERT((boost::is_same<v2, char>));