mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 03:57:36 +02:00
Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
This commit is contained in:
@ -1,20 +0,0 @@
|
||||
#==============================================================================
|
||||
# Copyright (c) 2003-2006 Joel de Guzman
|
||||
# Copyright (c) 2006 Dan Marsden
|
||||
#
|
||||
# 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)
|
||||
#==============================================================================
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
{
|
||||
test-suite example :
|
||||
|
||||
[ run test_example.cpp : : : : ]
|
||||
[ run triple.cpp : : : : ]
|
||||
;
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_ADVANCE_IMPL_20060222_2150)
|
||||
#define BOOST_FUSION_ADVANCE_IMPL_20060222_2150
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct advance_impl;
|
||||
|
||||
template<>
|
||||
struct advance_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename Iterator, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::struct_type struct_type;
|
||||
typedef typename Iterator::index index;
|
||||
typedef example::example_struct_iterator<
|
||||
struct_type, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
return type(it.struct_);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,67 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_IMPL_20060223_2017)
|
||||
#define BOOST_FUSION_AT_IMPL_20060223_2017
|
||||
|
||||
#include <string>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct at_impl;
|
||||
|
||||
template<>
|
||||
struct at_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply;
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, mpl::int_<0> >
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>,
|
||||
std::string const&,
|
||||
std::string&>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return seq.name;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, mpl::int_<1> >
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>,
|
||||
int const&,
|
||||
int&>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return seq.age;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,72 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_KEY_IMPL_20060223_2017)
|
||||
#define BOOST_FUSION_AT_KEY_IMPL_20060223_2017
|
||||
|
||||
#include <string>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace fields
|
||||
{
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct at_key_impl;
|
||||
|
||||
template<>
|
||||
struct at_key_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply;
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, fields::name>
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>,
|
||||
std::string const&,
|
||||
std::string&>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return seq.name;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, fields::age>
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>,
|
||||
int const&,
|
||||
int&>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return seq.age;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_BEGIN_IMPL_20060222_2042)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_20060222_2042
|
||||
|
||||
#include "../example_struct_iterator.hpp"
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template<>
|
||||
struct begin_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef example::example_struct_iterator<Sequence, 0> type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return type(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_20060223_2037)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_20060223_2037
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<>
|
||||
struct category_of_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
struct type : random_access_traversal_tag, associative_sequence_tag {};
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,67 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_DEREF_IMPL_20060222_1952)
|
||||
#define BOOST_FUSION_DEREF_IMPL_20060222_1952
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template<>
|
||||
struct deref_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply;
|
||||
|
||||
template<typename Struct>
|
||||
struct apply<example::example_struct_iterator<Struct, 0> >
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Struct>, std::string const&, std::string&>::type type;
|
||||
|
||||
static type
|
||||
call(example::example_struct_iterator<Struct, 0> const& it)
|
||||
{
|
||||
return it.struct_.name;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Struct>
|
||||
struct apply<example::example_struct_iterator<Struct, 1> >
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Struct>, int const&, int&>::type type;
|
||||
|
||||
static type
|
||||
call(example::example_struct_iterator<Struct, 1> const& it)
|
||||
{
|
||||
return it.struct_.age;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,44 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_DISTANCE_IMPL_20060223_0814)
|
||||
#define BOOST_FUSION_DISTANCE_IMPL_20060223_0814
|
||||
|
||||
#include <boost/mpl/minus.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct distance_impl;
|
||||
|
||||
template<>
|
||||
struct distance_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename First, typename Last>
|
||||
struct apply
|
||||
: mpl::minus<typename Last::index, typename First::index>
|
||||
{
|
||||
typedef apply<First, Last> self;
|
||||
|
||||
static typename self::type
|
||||
call(First const& first, Last const& last)
|
||||
{
|
||||
return typename self::type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_END_IMPL_20060222_2042)
|
||||
#define BOOST_FUSION_END_IMPL_20060222_2042
|
||||
|
||||
#include "../example_struct_iterator.hpp"
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template<>
|
||||
struct end_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef example::example_struct_iterator<Sequence, 2> type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return type(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_EQUAL_TO_IMPL_20060223_1941)
|
||||
#define BOOST_FUSION_EQUAL_TO_IMPL_20060223_1941
|
||||
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct equal_to_impl;
|
||||
|
||||
template<>
|
||||
struct equal_to_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename It1, typename It2>
|
||||
struct apply
|
||||
: mpl::equal_to<
|
||||
typename It1::index,
|
||||
typename It2::index>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,45 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_HAS_KEY_IMPL_20060223_2156)
|
||||
#define BOOST_FUSION_HAS_KEY_IMPL_20060223_2156
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
namespace fields
|
||||
{
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct has_key_impl;
|
||||
|
||||
template<>
|
||||
struct has_key_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply
|
||||
: mpl::or_<
|
||||
is_same<Key, fields::name>,
|
||||
is_same<Key, fields::age> >
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_20060228_1946)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_20060228_1946
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_200604227_2150)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_200604227_2150
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<example::example_sequence_tag>
|
||||
: boost::mpl::false_
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_NEXT_IMPL_20060222_1859)
|
||||
#define BOOST_FUSION_NEXT_IMPL_20060222_1859
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct next_impl;
|
||||
|
||||
template<>
|
||||
struct next_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::struct_type struct_type;
|
||||
typedef typename Iterator::index index;
|
||||
typedef example::example_struct_iterator<struct_type, index::value + 1> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.struct_);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_PRIOR_IMPL_20060222_1944)
|
||||
#define BOOST_FUSION_PRIOR_IMPL_20060222_1944
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct prior_impl;
|
||||
|
||||
template<>
|
||||
struct prior_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::struct_type struct_type;
|
||||
typedef typename Iterator::index index;
|
||||
typedef example::example_struct_iterator<struct_type, index::value - 1> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.struct_);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SIZE_IMPL_20060223_2033)
|
||||
#define BOOST_FUSION_SIZE_IMPL_20060223_2033
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct size_impl;
|
||||
|
||||
template<>
|
||||
struct size_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
: mpl::int_<2>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,44 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_IMPL_20060223_2025)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_20060223_2025
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct value_at_impl;
|
||||
|
||||
template<>
|
||||
struct value_at_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence, typename N>
|
||||
struct apply;
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, mpl::int_<0> >
|
||||
{
|
||||
typedef std::string type;
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, mpl::int_<1> >
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_KEY_IMPL_20060223_2025)
|
||||
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_20060223_2025
|
||||
|
||||
namespace fields
|
||||
{
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct value_at_key_impl;
|
||||
|
||||
template<>
|
||||
struct value_at_key_impl<example::example_sequence_tag>
|
||||
{
|
||||
template<typename Sequence, typename N>
|
||||
struct apply;
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, fields::name>
|
||||
{
|
||||
typedef std::string type;
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct apply<Sequence, fields::age>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_OF_IMPL_20060223_1905)
|
||||
#define BOOST_FUSION_VALUE_OF_IMPL_20060223_1905
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct value_of_impl;
|
||||
|
||||
template<>
|
||||
struct value_of_impl<example::example_struct_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply;
|
||||
|
||||
template<typename Struct>
|
||||
struct apply<example::example_struct_iterator<Struct, 0> >
|
||||
{
|
||||
typedef std::string type;
|
||||
};
|
||||
|
||||
template<typename Struct>
|
||||
struct apply<example::example_struct_iterator<Struct, 1> >
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_EXAMPLE_STRUCT)
|
||||
#define BOOST_FUSION_EXAMPLE_STRUCT
|
||||
|
||||
#include "./tag_of.hpp"
|
||||
#include "./example_struct_iterator.hpp"
|
||||
#include "./detail/begin_impl.hpp"
|
||||
#include "./detail/end_impl.hpp"
|
||||
#include "./detail/at_impl.hpp"
|
||||
#include "./detail/value_at_impl.hpp"
|
||||
#include "./detail/size_impl.hpp"
|
||||
#include "./detail/category_of_impl.hpp"
|
||||
#include "./detail/at_key_impl.hpp"
|
||||
#include "./detail/value_at_key_impl.hpp"
|
||||
#include "./detail/has_key_impl.hpp"
|
||||
#include "./detail/is_sequence_impl.hpp"
|
||||
#include "./detail/is_view_impl.hpp"
|
||||
|
||||
#endif
|
@ -1,64 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_EXAMPLE_STRUCT_ITERATOR)
|
||||
#define BOOST_FUSION_EXAMPLE_STRUCT_ITERATOR
|
||||
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include "./detail/next_impl.hpp"
|
||||
#include "./detail/prior_impl.hpp"
|
||||
#include "./detail/deref_impl.hpp"
|
||||
#include "./detail/advance_impl.hpp"
|
||||
#include "./detail/distance_impl.hpp"
|
||||
#include "./detail/value_of_impl.hpp"
|
||||
#include "./detail/equal_to_impl.hpp"
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct_iterator_tag;
|
||||
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template<typename Struct, int Pos>
|
||||
struct tag_of<example::example_struct_iterator<Struct, Pos> >
|
||||
{
|
||||
typedef example::example_struct_iterator_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
namespace example {
|
||||
template<typename Struct, int Pos>
|
||||
struct example_struct_iterator
|
||||
: boost::fusion::iterator_base<example_struct_iterator<Struct, Pos> >
|
||||
{
|
||||
BOOST_STATIC_ASSERT(Pos >=0 && Pos < 3);
|
||||
typedef Struct struct_type;
|
||||
typedef boost::mpl::int_<Pos> index;
|
||||
typedef boost::fusion::random_access_traversal_tag category;
|
||||
|
||||
example_struct_iterator(Struct& str)
|
||||
: struct_(str) {}
|
||||
|
||||
Struct& struct_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,27 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_EXAMPLE_STRUCT_TYPE)
|
||||
#define BOOST_FUSION_EXAMPLE_STRUCT_TYPE
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_struct
|
||||
{
|
||||
std::string name;
|
||||
int age;
|
||||
example_struct(
|
||||
const std::string& n,
|
||||
int a)
|
||||
: name(n), age(a)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_TAG_OF_20060222_2052)
|
||||
#define BOOST_FUSION_TAG_OF_20060222_2052
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include "./example_struct_type.hpp"
|
||||
|
||||
namespace example
|
||||
{
|
||||
struct example_sequence_tag;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct tag_of<example::example_struct>
|
||||
{
|
||||
typedef example::example_sequence_tag type;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -1,62 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#include "./example_struct.hpp"
|
||||
#include "./example_struct_type.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/iterator.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
example::example_struct bert("bert", 99);
|
||||
using namespace boost::fusion;
|
||||
|
||||
BOOST_MPL_ASSERT((traits::is_associative<example::example_struct>));
|
||||
BOOST_MPL_ASSERT((traits::is_random_access<example::example_struct>));
|
||||
BOOST_MPL_ASSERT((traits::is_sequence<example::example_struct>));
|
||||
|
||||
BOOST_TEST(deref(begin(bert)) == "bert");
|
||||
BOOST_TEST(*next(begin(bert)) == 99);
|
||||
BOOST_TEST(*prior(end(bert)) == 99);
|
||||
BOOST_TEST(*advance_c<1>(begin(bert)) == 99);
|
||||
BOOST_TEST(*advance_c<-1>(end(bert)) == 99);
|
||||
BOOST_TEST(distance(begin(bert), end(bert)) == 2);
|
||||
|
||||
typedef result_of::begin<example::example_struct>::type first;
|
||||
typedef result_of::next<first>::type second;
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<first>::type, std::string>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<second>::type, int>));
|
||||
|
||||
BOOST_TEST(begin(bert) != end(bert));
|
||||
BOOST_TEST(advance_c<2>(begin(bert)) == end(const_cast<const example::example_struct&>(bert)));
|
||||
|
||||
BOOST_TEST(at_c<0>(bert) == "bert");
|
||||
BOOST_TEST(at_c<1>(bert) == 99);
|
||||
|
||||
BOOST_TEST(at_key<fields::name>(bert) == "bert");
|
||||
BOOST_TEST(at_key<fields::age>(bert) == 99);
|
||||
|
||||
BOOST_TEST(has_key<fields::name>(bert));
|
||||
BOOST_TEST(has_key<fields::age>(bert));
|
||||
BOOST_TEST(!has_key<int>(bert));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_c<example::example_struct, 0>::type, std::string>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_c<example::example_struct, 1>::type, int>));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<example::example_struct, fields::name>::type, std::string>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<example::example_struct, fields::age>::type, int>));
|
||||
|
||||
BOOST_TEST(size(bert) == 2);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
@ -1,319 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
An implementation of a std::pair like triple<T0, T1, T2>
|
||||
We use fusion::sequence_facade and fusion::iterator_facade
|
||||
to make our triple a fully conforming Boost.Fusion random
|
||||
traversal sequence.
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/sequence_facade.hpp>
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/iterator.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace demo
|
||||
{
|
||||
template<typename Seq, int N>
|
||||
struct triple_iterator
|
||||
: fusion::iterator_facade<triple_iterator<Seq, N>, fusion::random_access_traversal_tag>
|
||||
{
|
||||
typedef mpl::int_<N> index;
|
||||
typedef Seq sequence_type;
|
||||
|
||||
triple_iterator(Seq& seq)
|
||||
: seq_(seq) {}
|
||||
|
||||
Seq& seq_;
|
||||
|
||||
template<typename T>
|
||||
struct value_of;
|
||||
|
||||
template<typename Sq>
|
||||
struct value_of<triple_iterator<Sq, 0> >
|
||||
: mpl::identity<typename Sq::t0_type>
|
||||
{};
|
||||
|
||||
template<typename Sq>
|
||||
struct value_of<triple_iterator<Sq, 1> >
|
||||
: mpl::identity<typename Sq::t1_type>
|
||||
{};
|
||||
|
||||
template<typename Sq>
|
||||
struct value_of<triple_iterator<Sq, 2> >
|
||||
: mpl::identity<typename Sq::t2_type>
|
||||
{};
|
||||
|
||||
template<typename T>
|
||||
struct deref;
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 0> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t0_type const&
|
||||
, typename Sq::t0_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 0> const& iter)
|
||||
{
|
||||
return iter.seq_.t0;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 1> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t1_type const&
|
||||
, typename Sq::t1_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 1> const& iter)
|
||||
{
|
||||
return iter.seq_.t1;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 2> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t2_type const&
|
||||
, typename Sq::t2_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 2> const& iter)
|
||||
{
|
||||
return iter.seq_.t2;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename It>
|
||||
struct next
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type, It::index::value + 1> type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
return type(it.seq_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename It>
|
||||
struct prior
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type, It::index::value - 1> type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
return type(it.seq_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename It1, typename It2>
|
||||
struct distance
|
||||
{
|
||||
typedef typename mpl::minus<typename It2::index, typename It1::index>::type type;
|
||||
|
||||
static type call(It1 const& it1, It2 const& it2)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename It, typename M>
|
||||
struct advance
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type,
|
||||
It::index::value + M::value> type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
return type(it.seq_);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T0, typename T1, typename T2>
|
||||
struct triple
|
||||
: fusion::sequence_facade<triple<T0, T1, T2>, fusion::random_access_traversal_tag>
|
||||
{
|
||||
triple(T0 const& t0, T1 const& t1, T2 const& t2)
|
||||
: t0(t0), t1(t1), t2(t2)
|
||||
{}
|
||||
|
||||
template<typename Sq>
|
||||
struct begin
|
||||
{
|
||||
typedef demo::triple_iterator<
|
||||
Sq, 0> type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
return type(sq);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct end
|
||||
{
|
||||
typedef demo::triple_iterator<
|
||||
Sq, 3> type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
return type(sq);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct size
|
||||
: mpl::int_<3>
|
||||
{};
|
||||
|
||||
template<typename Sq, typename N>
|
||||
struct value_at
|
||||
: value_at<Sq, mpl::int_<N::value> >
|
||||
{};
|
||||
|
||||
template<typename Sq>
|
||||
struct value_at<Sq, mpl::int_<0> >
|
||||
{
|
||||
typedef typename Sq::t0_type type;
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct value_at<Sq, mpl::int_<1> >
|
||||
{
|
||||
typedef typename Sq::t1_type type;
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct value_at<Sq, mpl::int_<2> >
|
||||
{
|
||||
typedef typename Sq::t2_type type;
|
||||
};
|
||||
|
||||
template<typename Sq, typename N>
|
||||
struct at
|
||||
: at<Sq, mpl::int_<N::value> >
|
||||
{};
|
||||
|
||||
template<typename Sq>
|
||||
struct at<Sq, mpl::int_<0> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t0_type const&
|
||||
, typename Sq::t0_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
return sq.t0;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct at<Sq, mpl::int_<1> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t1_type const&
|
||||
, typename Sq::t1_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
return sq.t1;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Sq>
|
||||
struct at<Sq, mpl::int_<2> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t2_type const&
|
||||
, typename Sq::t2_type&
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
return sq.t2;
|
||||
}
|
||||
};
|
||||
|
||||
typedef T0 t0_type;
|
||||
typedef T1 t1_type;
|
||||
typedef T2 t2_type;
|
||||
|
||||
T0 t0;
|
||||
T1 t1;
|
||||
T2 t2;
|
||||
};
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef demo::triple<int, char, std::string> my_triple;
|
||||
my_triple t(101, 'a', "hello");
|
||||
BOOST_TEST(*fusion::begin(t) == 101);
|
||||
BOOST_TEST(*fusion::next(fusion::begin(t)) == 'a');
|
||||
BOOST_TEST(*fusion::prior(fusion::end(t)) == "hello");
|
||||
BOOST_TEST(fusion::distance(fusion::begin(t), fusion::end(t)) == 3);
|
||||
BOOST_TEST(fusion::size(t) == 3);
|
||||
BOOST_MPL_ASSERT((boost::is_same<int, fusion::result_of::value_at_c<my_triple, 0>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<char, fusion::result_of::value_at_c<my_triple, 1>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<std::string, fusion::result_of::value_at_c<my_triple, 2>::type>));
|
||||
BOOST_TEST(fusion::at_c<0>(t) == 101);
|
||||
BOOST_TEST(fusion::at_c<1>(t) == 'a');
|
||||
BOOST_TEST(fusion::at_c<2>(t) == "hello");
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user