forked from boostorg/fusion
branch for creating branch for fusion 2.1
[SVN r40237]
This commit is contained in:
17
include/boost/fusion/adapted.hpp
Normal file
17
include/boost/fusion/adapted.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_ADAPTED_30122005_1420)
|
||||||
|
#define BOOST_FUSION_ADAPTED_30122005_1420
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/boost_tuple.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_pair.hpp>
|
||||||
|
#include <boost/fusion/adapted/array.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant.hpp>
|
||||||
|
|
||||||
|
#endif
|
22
include/boost/fusion/adapted/array.hpp
Normal file
22
include/boost/fusion/adapted/array.hpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_ARRAY_27122005_1035)
|
||||||
|
#define BOOST_FUSION_ARRAY_27122005_1035
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/array/array_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/tag_of.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/array/detail/value_at_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
107
include/boost/fusion/adapted/array/array_iterator.hpp
Normal file
107
include/boost/fusion/adapted/array/array_iterator.hpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_ARRAY_ITERATOR_26122005_2250)
|
||||||
|
#define BOOST_FUSION_ARRAY_ITERATOR_26122005_2250
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/minus.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
template <typename Array, int Pos>
|
||||||
|
struct array_iterator
|
||||||
|
: iterator_facade<array_iterator<Array, Pos>, random_access_traversal_tag>
|
||||||
|
{
|
||||||
|
BOOST_MPL_ASSERT_RELATION(Pos, >=, 0);
|
||||||
|
BOOST_MPL_ASSERT_RELATION(Pos, <=, Array::static_size);
|
||||||
|
|
||||||
|
typedef mpl::int_<Pos> index;
|
||||||
|
typedef Array array_type;
|
||||||
|
|
||||||
|
array_iterator(Array& a)
|
||||||
|
: array(a) {}
|
||||||
|
|
||||||
|
Array& array;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of
|
||||||
|
{
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef typename array_type::value_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<array_type>
|
||||||
|
, typename array_type::const_reference
|
||||||
|
, typename array_type::reference
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const & it)
|
||||||
|
{
|
||||||
|
return it.array[Iterator::index::value];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance
|
||||||
|
{
|
||||||
|
typedef typename Iterator::index index;
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef array_iterator<array_type, index::value + N::value> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& i)
|
||||||
|
{
|
||||||
|
return type(i.array);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::minus<
|
||||||
|
typename I2::index, typename I1::index
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(I1 const&, I2 const&)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
array_iterator<Array, Pos>& operator=(array_iterator<Array, Pos> const&);
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/array/detail/at_impl.hpp
Normal file
45
include/boost/fusion/adapted/array/detail/at_impl.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1241)
|
||||||
|
#define BOOST_FUSION_AT_IMPL_27122005_1241
|
||||||
|
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct at_impl<array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename mpl::if_<
|
||||||
|
is_const<Sequence>,
|
||||||
|
typename Sequence::const_reference,
|
||||||
|
typename Sequence::reference>::type type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return seq[N::value];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/array/detail/begin_impl.hpp
Normal file
40
include/boost/fusion/adapted/array/detail/begin_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1117)
|
||||||
|
#define BOOST_FUSION_BEGIN_IMPL_27122005_1117
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/array/array_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef array_iterator<Sequence, 0> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1044)
|
||||||
|
#define BOOST_FUSION_CATEGORY_OF_IMPL_27122005_1044
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<array_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef random_access_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/array/detail/end_impl.hpp
Normal file
40
include/boost/fusion/adapted/array/detail/end_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1120)
|
||||||
|
#define BOOST_FUSION_END_IMPL_27122005_1120
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/array/array_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef array_iterator<Sequence, Sequence::static_size> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1648)
|
||||||
|
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1648
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/adapted/array/detail/is_view_impl.hpp
Normal file
32
include/boost/fusion/adapted/array/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27042006_2221)
|
||||||
|
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2221
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<array_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::false_
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
29
include/boost/fusion/adapted/array/detail/size_impl.hpp
Normal file
29
include/boost/fusion/adapted/array/detail/size_impl.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1251)
|
||||||
|
#define BOOST_FUSION_SIZE_IMPL_27122005_1251
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct size_impl<array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::int_<Sequence::static_size> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/adapted/array/detail/value_at_impl.hpp
Normal file
32
include/boost/fusion/adapted/array/detail/value_at_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1256)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_IMPL_27122005_1256
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename Sequence::value_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
35
include/boost/fusion/adapted/array/tag_of.hpp
Normal file
35
include/boost/fusion/adapted/array/tag_of.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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(FUSION_SEQUENCE_TAG_OF_27122005_1030)
|
||||||
|
#define FUSION_SEQUENCE_TAG_OF_27122005_1030
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
class array;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct array_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
struct tag_of<boost::array<T,N> >
|
||||||
|
{
|
||||||
|
typedef array_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
20
include/boost/fusion/adapted/boost_tuple.hpp
Normal file
20
include/boost/fusion/adapted/boost_tuple.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_BOOST_TUPLE_09272006_0732)
|
||||||
|
#define BOOST_FUSION_BOOST_TUPLE_09272006_0732
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/tag_of.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,149 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_BOOST_TUPLE_ITERATOR_09262006_1851)
|
||||||
|
#define FUSION_BOOST_TUPLE_ITERATOR_09262006_1851
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/type_traits/add_const.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/eval_if.hpp>
|
||||||
|
#include <boost/mpl/or.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct forward_traversal_tag;
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
struct boost_tuple_is_empty : mpl::false_ {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_is_empty<tuples::null_type> : mpl::true_ {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_is_empty<tuples::null_type const> : mpl::true_ {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_is_empty<tuples::tuple<> > : mpl::true_ {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_is_empty<tuples::tuple<> const> : mpl::true_ {};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Cons = tuples::null_type>
|
||||||
|
struct boost_tuple_iterator
|
||||||
|
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
|
||||||
|
{
|
||||||
|
typedef Cons cons_type;
|
||||||
|
|
||||||
|
explicit boost_tuple_iterator(Cons& cons)
|
||||||
|
: cons(cons) {}
|
||||||
|
Cons& cons;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of : mpl::identity<typename Iterator::cons_type::head_type> {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename value_of<Iterator>::type element;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<typename Iterator::cons_type>
|
||||||
|
, typename tuples::access_traits<element>::const_type
|
||||||
|
, typename tuples::access_traits<element>::non_const_type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return iter.cons.get_head();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next
|
||||||
|
{
|
||||||
|
typedef typename Iterator::cons_type cons_type;
|
||||||
|
typedef typename cons_type::tail_type tail_type;
|
||||||
|
|
||||||
|
typedef boost_tuple_iterator<
|
||||||
|
typename mpl::eval_if<
|
||||||
|
is_const<cons_type>
|
||||||
|
, add_const<tail_type>
|
||||||
|
, mpl::identity<tail_type>
|
||||||
|
>::type>
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return type(iter.cons.get_tail());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Null>
|
||||||
|
struct boost_tuple_null_iterator
|
||||||
|
: iterator_facade<boost_tuple_iterator<Null>, forward_traversal_tag>
|
||||||
|
{
|
||||||
|
typedef Null cons_type;
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct equal_to
|
||||||
|
: mpl::or_<
|
||||||
|
is_same<I1, I2>
|
||||||
|
, mpl::and_<
|
||||||
|
detail::boost_tuple_is_empty<typename I1::cons_type>
|
||||||
|
, detail::boost_tuple_is_empty<typename I2::cons_type>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_iterator<tuples::null_type>
|
||||||
|
: boost_tuple_null_iterator<tuples::null_type>
|
||||||
|
{
|
||||||
|
template <typename Cons>
|
||||||
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_iterator<tuples::null_type const>
|
||||||
|
: boost_tuple_null_iterator<tuples::null_type const>
|
||||||
|
{
|
||||||
|
template <typename Cons>
|
||||||
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_iterator<tuples::tuple<> >
|
||||||
|
: boost_tuple_null_iterator<tuples::tuple<> >
|
||||||
|
{
|
||||||
|
template <typename Cons>
|
||||||
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct boost_tuple_iterator<tuples::tuple<> const>
|
||||||
|
: boost_tuple_null_iterator<tuples::tuple<> const>
|
||||||
|
{
|
||||||
|
template <typename Cons>
|
||||||
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
50
include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp
Normal file
50
include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_AT_IMPL_09262006_1920)
|
||||||
|
#define BOOST_FUSION_AT_IMPL_09262006_1920
|
||||||
|
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
tuples::element<N::value, Sequence>::type
|
||||||
|
element;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<Sequence>
|
||||||
|
, typename tuples::access_traits<element>::const_type
|
||||||
|
, typename tuples::access_traits<element>::non_const_type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return tuples::get<N::value>(seq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,39 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_BEGIN_IMPL_09272006_0719)
|
||||||
|
#define BOOST_FUSION_BEGIN_IMPL_09272006_0719
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef boost_tuple_iterator<Sequence> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_09272006_0726)
|
||||||
|
#define BOOST_FUSION_CATEGORY_OF_IMPL_09272006_0726
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
struct forward_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef forward_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
54
include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp
Normal file
54
include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_END_IMPL_09272006_0721)
|
||||||
|
#define BOOST_FUSION_END_IMPL_09272006_0721
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace tuples
|
||||||
|
{
|
||||||
|
struct null_type;
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef
|
||||||
|
boost_tuple_iterator<
|
||||||
|
typename mpl::if_<
|
||||||
|
is_const<Sequence>
|
||||||
|
, tuples::null_type const
|
||||||
|
, tuples::null_type
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return type(seq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,30 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_09272006_0726)
|
||||||
|
#define BOOST_FUSION_IS_SEQUENCE_IMPL_09272006_0726
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,30 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_09272006_0725)
|
||||||
|
#define BOOST_FUSION_IS_VIEW_IMPL_09272006_0725
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::false_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_SIZE_IMPL_09272006_0724)
|
||||||
|
#define BOOST_FUSION_SIZE_IMPL_09272006_0724
|
||||||
|
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct size_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply : mpl::int_<tuples::length<Sequence>::value> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,30 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_VALUE_AT_IMPL_09262006_1926)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_IMPL_09262006_1926
|
||||||
|
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<boost_tuple_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply : tuples::element<N::value, Sequence> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
55
include/boost/fusion/adapted/boost_tuple/tag_of.hpp
Normal file
55
include/boost/fusion/adapted/boost_tuple/tag_of.hpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_TAG_OF_09262006_1900)
|
||||||
|
#define BOOST_FUSION_TAG_OF_09262006_1900
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace tuples
|
||||||
|
{
|
||||||
|
struct null_type;
|
||||||
|
|
||||||
|
template <
|
||||||
|
class T0, class T1, class T2, class T3, class T4,
|
||||||
|
class T5, class T6, class T7, class T8, class T9
|
||||||
|
>
|
||||||
|
class tuple;
|
||||||
|
|
||||||
|
template <class Head, class Tail>
|
||||||
|
struct cons;
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct boost_tuple_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template <
|
||||||
|
class T0, class T1, class T2, class T3, class T4,
|
||||||
|
class T5, class T6, class T7, class T8, class T9
|
||||||
|
>
|
||||||
|
struct tag_of<tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||||
|
{
|
||||||
|
typedef boost_tuple_tag type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Head, class Tail>
|
||||||
|
struct tag_of<tuples::cons<Head, Tail> >
|
||||||
|
{
|
||||||
|
typedef boost_tuple_tag type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct tag_of<tuples::null_type>
|
||||||
|
{
|
||||||
|
typedef boost_tuple_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
21
include/boost/fusion/adapted/mpl.hpp
Normal file
21
include/boost/fusion/adapted/mpl.hpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_MPL_31122005_1152)
|
||||||
|
#define BOOST_FUSION_MPL_31122005_1152
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/value_at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/has_key_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/detail/is_view_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/mpl/detail/at_impl.hpp
Normal file
40
include/boost/fusion/adapted/mpl/detail/at_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1642)
|
||||||
|
#define BOOST_FUSION_AT_IMPL_31122005_1642
|
||||||
|
|
||||||
|
#include <boost/mpl/at.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename mpl::at<Sequence, N>::type type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/mpl/detail/begin_impl.hpp
Normal file
45
include/boost/fusion/adapted/mpl/detail/begin_impl.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1209)
|
||||||
|
#define BOOST_FUSION_BEGIN_IMPL_31122005_1209
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||||
|
#include <boost/mpl/begin.hpp>
|
||||||
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename mpl::begin<
|
||||||
|
typename remove_const<Sequence>::type
|
||||||
|
>::type iterator;
|
||||||
|
typedef mpl_iterator<iterator> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
54
include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp
Normal file
54
include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_20060217_2141)
|
||||||
|
#define BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141
|
||||||
|
|
||||||
|
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
|
||||||
|
#include <boost/mpl/begin_end.hpp>
|
||||||
|
#include <boost/mpl/is_sequence.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
struct mpl_sequence_category_of
|
||||||
|
{
|
||||||
|
// assumes T is an mpl sequence
|
||||||
|
// there should be no way this will ever be
|
||||||
|
// called where T is an mpl iterator
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value);
|
||||||
|
typedef typename
|
||||||
|
mpl_iterator_category<
|
||||||
|
typename mpl::begin<T>::type::category
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
: detail::mpl_sequence_category_of<T>
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
28
include/boost/fusion/adapted/mpl/detail/empty_impl.hpp
Normal file
28
include/boost/fusion/adapted/mpl/detail/empty_impl.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_EMPTY_IMPL_31122005_1554)
|
||||||
|
#define BOOST_FUSION_EMPTY_IMPL_31122005_1554
|
||||||
|
|
||||||
|
#include <boost/mpl/empty.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
struct empty_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply : mpl::empty<Sequence> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/mpl/detail/end_impl.hpp
Normal file
45
include/boost/fusion/adapted/mpl/detail/end_impl.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1237)
|
||||||
|
#define BOOST_FUSION_END_IMPL_31122005_1237
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||||
|
#include <boost/mpl/end.hpp>
|
||||||
|
#include <boost/type_traits/add_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename mpl::end<
|
||||||
|
typename remove_const<Sequence>::type
|
||||||
|
>::type iterator;
|
||||||
|
typedef mpl_iterator<iterator> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp
Normal file
31
include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1647)
|
||||||
|
#define BOOST_FUSION_HAS_KEY_IMPL_31122005_1647
|
||||||
|
|
||||||
|
#include <boost/mpl/has_key.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct has_key_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct has_key_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Key>
|
||||||
|
struct apply : mpl::has_key<Sequence, Key> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp
Normal file
31
include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1505)
|
||||||
|
#define BOOST_FUSION_IS_SEQUENCE_IMPL_31122005_1505
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp
Normal file
32
include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_03202006_0048)
|
||||||
|
#define BOOST_FUSION_IS_VIEW_IMPL_03202006_0048
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::true_
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/mpl/detail/size_impl.hpp
Normal file
31
include/boost/fusion/adapted/mpl/detail/size_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1508)
|
||||||
|
#define BOOST_FUSION_SIZE_IMPL_31122005_1508
|
||||||
|
|
||||||
|
#include <boost/mpl/size.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct size_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply : mpl::size<Sequence> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp
Normal file
31
include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_31122005_1621)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_IMPL_31122005_1621
|
||||||
|
|
||||||
|
#include <boost/mpl/at.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct mpl_sequence_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<mpl_sequence_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply : mpl::at<Sequence, N> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
113
include/boost/fusion/adapted/mpl/mpl_iterator.hpp
Normal file
113
include/boost/fusion/adapted/mpl/mpl_iterator.hpp
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_MPL_ITERATOR_05052005_0731)
|
||||||
|
#define FUSION_MPL_ITERATOR_05052005_0731
|
||||||
|
|
||||||
|
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
#include <boost/mpl/deref.hpp>
|
||||||
|
#include <boost/mpl/next.hpp>
|
||||||
|
#include <boost/mpl/prior.hpp>
|
||||||
|
#include <boost/mpl/advance.hpp>
|
||||||
|
#include <boost/mpl/distance.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
template <typename Iterator_>
|
||||||
|
struct mpl_iterator
|
||||||
|
: iterator_facade<
|
||||||
|
mpl_iterator<Iterator_>
|
||||||
|
, typename detail::mpl_iterator_category<typename Iterator_::category>::type
|
||||||
|
>
|
||||||
|
{
|
||||||
|
typedef typename remove_const<Iterator_>::type iterator_type;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of : mpl::deref<typename Iterator::iterator_type> {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename mpl::deref<
|
||||||
|
typename Iterator::iterator_type>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next
|
||||||
|
{
|
||||||
|
typedef mpl_iterator<
|
||||||
|
typename mpl::next<typename Iterator::iterator_type>::type>
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct prior
|
||||||
|
{
|
||||||
|
typedef mpl_iterator<
|
||||||
|
typename mpl::prior<typename Iterator::iterator_type>::type>
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance
|
||||||
|
{
|
||||||
|
typedef mpl_iterator<
|
||||||
|
typename mpl::advance<typename Iterator::iterator_type, N>::type>
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& i)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct distance :
|
||||||
|
mpl::distance<
|
||||||
|
typename I1::iterator_type
|
||||||
|
, typename I2::iterator_type>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::distance<
|
||||||
|
typename I1::iterator_type
|
||||||
|
, typename I2::iterator_type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(I1 const&, I2 const&)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
66
include/boost/fusion/adapted/std_pair.hpp
Normal file
66
include/boost/fusion/adapted/std_pair.hpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_STD_PAIR_24122005_1744)
|
||||||
|
#define BOOST_FUSION_STD_PAIR_24122005_1744
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
struct tag_of<std::pair<T1, T2> >
|
||||||
|
{
|
||||||
|
typedef struct_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Struct, int N>
|
||||||
|
struct struct_member;
|
||||||
|
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size;
|
||||||
|
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
struct struct_member<std::pair<T1, T2>, 0>
|
||||||
|
{
|
||||||
|
typedef T1 type;
|
||||||
|
|
||||||
|
static type& call(std::pair<T1, T2>& pair)
|
||||||
|
{
|
||||||
|
return pair.first;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
struct struct_member<std::pair<T1, T2>, 1>
|
||||||
|
{
|
||||||
|
typedef T2 type;
|
||||||
|
|
||||||
|
static type& call(std::pair<T1, T2>& pair)
|
||||||
|
{
|
||||||
|
return pair.second;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
struct struct_size<std::pair<T1, T2> > : mpl::int_<2>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
71
include/boost/fusion/adapted/std_pair/detail/at_impl.hpp
Normal file
71
include/boost/fusion/adapted/std_pair/detail/at_impl.hpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1807)
|
||||||
|
#define BOOST_FUSION_AT_IMPL_24122005_1807
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
#include <boost/fusion/support/detail/access.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
static int const n_value = N::value;
|
||||||
|
BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2));
|
||||||
|
typedef typename
|
||||||
|
mpl::if_c<
|
||||||
|
(n_value == 0)
|
||||||
|
, typename Sequence::first_type
|
||||||
|
, typename Sequence::second_type
|
||||||
|
>
|
||||||
|
element;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::eval_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, detail::cref_result<element>
|
||||||
|
, detail::ref_result<element>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
template <typename RT>
|
||||||
|
static RT get(Sequence& p, mpl::int_<0>)
|
||||||
|
{
|
||||||
|
return p.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename RT>
|
||||||
|
static RT get(Sequence& p, mpl::int_<1>)
|
||||||
|
{
|
||||||
|
return p.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& p)
|
||||||
|
{
|
||||||
|
return get<type>(p, N());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp
Normal file
40
include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1752)
|
||||||
|
#define BOOST_FUSION_BEGIN_IMPL_24122005_1752
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_pair/std_pair_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef std_pair_iterator<Sequence, 0> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1731)
|
||||||
|
#define BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef random_access_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/std_pair/detail/end_impl.hpp
Normal file
40
include/boost/fusion/adapted/std_pair/detail/end_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1755)
|
||||||
|
#define BOOST_FUSION_END_IMPL_24122005_1755
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_pair/std_pair_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef std_pair_iterator<Sequence, 2> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1651)
|
||||||
|
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27042006_2219)
|
||||||
|
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2219
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::false_
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/std_pair/detail/size_impl.hpp
Normal file
31
include/boost/fusion/adapted/std_pair/detail/size_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1759)
|
||||||
|
#define BOOST_FUSION_SIZE_IMPL_24122005_1759
|
||||||
|
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct size_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply : mpl::int_<2> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,43 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1917)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_IMPL_24122005_1917
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<std_pair_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
static int const n_value = N::value;
|
||||||
|
BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2));
|
||||||
|
typedef typename
|
||||||
|
mpl::if_c<
|
||||||
|
(n_value == 0)
|
||||||
|
, typename Sequence::first_type
|
||||||
|
, typename Sequence::second_type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
127
include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp
Normal file
127
include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_STD_PAIR_ITERATOR_09262005_0934)
|
||||||
|
#define FUSION_STD_PAIR_ITERATOR_09262005_0934
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/mpl/minus.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
template <typename Pair_, int N_>
|
||||||
|
struct std_pair_iterator
|
||||||
|
: iterator_facade<std_pair_iterator<Pair_, N_>, random_access_traversal_tag>
|
||||||
|
{
|
||||||
|
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||||
|
BOOST_MPL_ASSERT_RELATION(N_, <=, 2);
|
||||||
|
|
||||||
|
typedef mpl::int_<N_> index;
|
||||||
|
typedef Pair_ pair_type;
|
||||||
|
|
||||||
|
std_pair_iterator(Pair_& pair)
|
||||||
|
: pair(pair) {}
|
||||||
|
Pair_& pair;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of;
|
||||||
|
|
||||||
|
template <typename Pair>
|
||||||
|
struct value_of<std_pair_iterator<Pair, 0> >
|
||||||
|
: mpl::identity<typename Pair::first_type> {};
|
||||||
|
|
||||||
|
template <typename Pair>
|
||||||
|
struct value_of<std_pair_iterator<Pair, 1> >
|
||||||
|
: mpl::identity<typename Pair::second_type> {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref;
|
||||||
|
|
||||||
|
template <typename Pair>
|
||||||
|
struct deref<std_pair_iterator<Pair, 0> >
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<Pair>
|
||||||
|
, typename Pair::first_type const&
|
||||||
|
, typename Pair::first_type&
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(std_pair_iterator<Pair, 0> const& iter)
|
||||||
|
{
|
||||||
|
return iter.pair.first;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Pair>
|
||||||
|
struct deref<std_pair_iterator<Pair, 1> >
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<Pair>
|
||||||
|
, typename Pair::second_type const&
|
||||||
|
, typename Pair::second_type&
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(std_pair_iterator<Pair, 1> const& iter)
|
||||||
|
{
|
||||||
|
return iter.pair.second;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance
|
||||||
|
{
|
||||||
|
typedef typename Iterator::index index;
|
||||||
|
typedef typename Iterator::pair_type pair_type;
|
||||||
|
typedef std_pair_iterator<pair_type, index::value + N::value> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return type(iter.pair);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::minus<
|
||||||
|
typename I2::index, typename I1::index
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(I1 const&, I2 const&)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
29
include/boost/fusion/adapted/std_pair/tag_of.hpp
Normal file
29
include/boost/fusion/adapted/std_pair/tag_of.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1722)
|
||||||
|
#define BOOST_FUSION_TAG_OF_24122005_1722
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_pair_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template<typename T1, typename T2>
|
||||||
|
struct tag_of<std::pair<T1, T2> >
|
||||||
|
{
|
||||||
|
typedef std_pair_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
23
include/boost/fusion/adapted/struct.hpp
Normal file
23
include/boost/fusion/adapted/struct.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_STRUCT_24122005_1744)
|
||||||
|
#define BOOST_FUSION_STD_STRUCT_24122005_1744
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/struct/extension.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
94
include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp
Normal file
94
include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_ADAPT_ASSOC_STRUCT_20070508_2207)
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_20070508_2207
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/extension.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/has_key_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/at_key_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/value_at_key_impl.hpp>
|
||||||
|
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||||
|
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||||
|
#include <boost/preprocessor/tuple/elem.hpp>
|
||||||
|
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||||
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace extension {
|
||||||
|
template<typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member;
|
||||||
|
}}}
|
||||||
|
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT(name, bseq) \
|
||||||
|
BOOST_FUSION_ADAPT_ASSOC_STRUCT_I( \
|
||||||
|
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_X bseq, 0)) \
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_X(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_Y
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_Y(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_X
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_X0
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_Y0
|
||||||
|
|
||||||
|
// BOOST_FUSION_ADAPT_ASSOC_STRUCT_I generates the overarching structure and uses
|
||||||
|
// SEQ_FOR_EACH_I to generate the "linear" substructures.
|
||||||
|
// Thanks to Paul Mensonides for the PP macro help
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_I(name, seq) \
|
||||||
|
namespace boost { namespace fusion { namespace traits \
|
||||||
|
{ \
|
||||||
|
template <> \
|
||||||
|
struct tag_of<name> \
|
||||||
|
{ \
|
||||||
|
typedef struct_tag type; \
|
||||||
|
}; \
|
||||||
|
}}} \
|
||||||
|
namespace boost { namespace fusion { namespace extension \
|
||||||
|
{ \
|
||||||
|
template <> \
|
||||||
|
struct struct_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
|
||||||
|
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_ASSOC_STRUCT_C, name, seq) \
|
||||||
|
}}} \
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C(r, name, i, xy) \
|
||||||
|
template <> \
|
||||||
|
struct struct_member<name, i> \
|
||||||
|
{ \
|
||||||
|
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
|
||||||
|
static type& call(name& struct_) \
|
||||||
|
{ \
|
||||||
|
return struct_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
template<> \
|
||||||
|
struct struct_assoc_member<name, BOOST_PP_TUPLE_ELEM(3, 2, xy)> \
|
||||||
|
{ \
|
||||||
|
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
|
||||||
|
static type& call(name& struct_) \
|
||||||
|
{ \
|
||||||
|
return struct_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
|
||||||
|
}; \
|
||||||
|
};
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#endif
|
75
include/boost/fusion/adapted/struct/adapt_struct.hpp
Normal file
75
include/boost/fusion/adapted/struct/adapt_struct.hpp
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_ADAPT_STRUCT_APRIL_2_2007_1158AM)
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_APRIL_2_2007_1158AM
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/extension.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||||
|
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||||
|
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||||
|
#include <boost/preprocessor/tuple/elem.hpp>
|
||||||
|
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||||
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT(name, bseq) \
|
||||||
|
BOOST_FUSION_ADAPT_STRUCT_I( \
|
||||||
|
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_X bseq, 0)) \
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_X(x, y) ((x, y)) BOOST_FUSION_ADAPT_STRUCT_Y
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_Y(x, y) ((x, y)) BOOST_FUSION_ADAPT_STRUCT_X
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_X0
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_Y0
|
||||||
|
|
||||||
|
// BOOST_FUSION_ADAPT_STRUCT_I generates the overarching structure and uses
|
||||||
|
// SEQ_FOR_EACH_I to generate the "linear" substructures.
|
||||||
|
// Thanks to Paul Mensonides for the PP macro help
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_I(name, seq) \
|
||||||
|
namespace boost { namespace fusion { namespace traits \
|
||||||
|
{ \
|
||||||
|
template <> \
|
||||||
|
struct tag_of<name> \
|
||||||
|
{ \
|
||||||
|
typedef struct_tag type; \
|
||||||
|
}; \
|
||||||
|
}}} \
|
||||||
|
namespace boost { namespace fusion { namespace extension \
|
||||||
|
{ \
|
||||||
|
template <> \
|
||||||
|
struct struct_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
|
||||||
|
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_STRUCT_C, name, seq) \
|
||||||
|
}}} \
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_STRUCT_C(r, name, i, xy) \
|
||||||
|
template <> \
|
||||||
|
struct struct_member<name, i> \
|
||||||
|
{ \
|
||||||
|
typedef BOOST_PP_TUPLE_ELEM(2, 0, xy) type; \
|
||||||
|
static type& call(name& struct_) \
|
||||||
|
{ \
|
||||||
|
return struct_.BOOST_PP_TUPLE_ELEM(2, 1, xy); \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
/***/
|
||||||
|
|
||||||
|
#endif
|
63
include/boost/fusion/adapted/struct/detail/at_impl.hpp
Normal file
63
include/boost/fusion/adapted/struct/detail/at_impl.hpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1807)
|
||||||
|
#define BOOST_FUSION_AT_IMPL_24122005_1807
|
||||||
|
|
||||||
|
#include <boost/fusion/support/detail/access.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template <typename Struct, int N>
|
||||||
|
struct struct_member;
|
||||||
|
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
static int const n_value = N::value;
|
||||||
|
BOOST_MPL_ASSERT_RELATION(
|
||||||
|
n_value, <=, extension::struct_size<Sequence>::value);
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
extension::struct_member<Sequence, N::value>
|
||||||
|
element;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::eval_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, detail::cref_result<element>
|
||||||
|
, detail::ref_result<element>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return extension::
|
||||||
|
struct_member<Sequence, N::value>::call(seq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
54
include/boost/fusion/adapted/struct/detail/at_key_impl.hpp
Normal file
54
include/boost/fusion/adapted/struct/detail/at_key_impl.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2007 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_20070508_2248)
|
||||||
|
#define BOOST_FUSION_AT_KEY_IMPL_20070508_2248
|
||||||
|
|
||||||
|
#include <boost/fusion/support/detail/access.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_key_impl;
|
||||||
|
|
||||||
|
template <typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_key_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Key>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
extension::struct_assoc_member<Sequence, Key>
|
||||||
|
element;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::eval_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, detail::cref_result<element>
|
||||||
|
, detail::ref_result<element>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return extension::
|
||||||
|
struct_assoc_member<Sequence, Key>::call(seq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/struct/detail/begin_impl.hpp
Normal file
40
include/boost/fusion/adapted/struct/detail/begin_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1752)
|
||||||
|
#define BOOST_FUSION_BEGIN_IMPL_24122005_1752
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef struct_iterator<Sequence, 0> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1731)
|
||||||
|
#define BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef random_access_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/struct/detail/end_impl.hpp
Normal file
40
include/boost/fusion/adapted/struct/detail/end_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1755)
|
||||||
|
#define BOOST_FUSION_END_IMPL_24122005_1755
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef struct_iterator<Sequence, 2> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/adapted/struct/detail/has_key_impl.hpp
Normal file
40
include/boost/fusion/adapted/struct/detail/has_key_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2007 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_20070508_2231)
|
||||||
|
#define BOOST_FUSION_HAS_KEY_IMPL_20070508_2231
|
||||||
|
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#include <boost/mpl/not.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
struct no_such_member;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct has_key_impl;
|
||||||
|
|
||||||
|
template<typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct has_key_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence, typename Key>
|
||||||
|
struct apply
|
||||||
|
: mpl::not_<is_same<no_such_member, typename struct_assoc_member<Sequence, Key>::type> >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27122005_1651)
|
||||||
|
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/adapted/struct/detail/is_view_impl.hpp
Normal file
32
include/boost/fusion/adapted/struct/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_27042006_2219)
|
||||||
|
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2219
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::false_
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
37
include/boost/fusion/adapted/struct/detail/size_impl.hpp
Normal file
37
include/boost/fusion/adapted/struct/detail/size_impl.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1759)
|
||||||
|
#define BOOST_FUSION_SIZE_IMPL_24122005_1759
|
||||||
|
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct size_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply : extension::struct_size<Sequence> {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
47
include/boost/fusion/adapted/struct/detail/value_at_impl.hpp
Normal file
47
include/boost/fusion/adapted/struct/detail/value_at_impl.hpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_24122005_1917)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_IMPL_24122005_1917
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <typename Struct, int N>
|
||||||
|
struct struct_member;
|
||||||
|
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
static int const n_value = N::value;
|
||||||
|
BOOST_MPL_ASSERT_RELATION(
|
||||||
|
n_value, <=, extension::struct_size<Sequence>::value);
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
extension::struct_member<Sequence, N::value>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,39 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2007 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_20070508_2300)
|
||||||
|
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_20070508_2300
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct struct_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_key_impl;
|
||||||
|
|
||||||
|
template <typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_key_impl<struct_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Key>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
extension::struct_assoc_member<Sequence, Key>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
68
include/boost/fusion/adapted/struct/extension.hpp
Normal file
68
include/boost/fusion/adapted/struct/extension.hpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 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(FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM)
|
||||||
|
#define FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM
|
||||||
|
|
||||||
|
#include <boost/type_traits/add_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace extension
|
||||||
|
{
|
||||||
|
template <typename Struct, int N>
|
||||||
|
struct struct_member;
|
||||||
|
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size;
|
||||||
|
|
||||||
|
template <typename Struct, int N>
|
||||||
|
struct struct_member<Struct const, N>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
add_const<typename struct_member<Struct, N>::type>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type&
|
||||||
|
call(Struct const& struct_)
|
||||||
|
{
|
||||||
|
return struct_member<Struct, N>::call(
|
||||||
|
const_cast<Struct&>(struct_));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Struct>
|
||||||
|
struct struct_size<Struct const>
|
||||||
|
: struct_size<Struct>
|
||||||
|
{};
|
||||||
|
|
||||||
|
struct no_such_member;
|
||||||
|
|
||||||
|
template<typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member
|
||||||
|
{
|
||||||
|
typedef no_such_member type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Struct, typename Key>
|
||||||
|
struct struct_assoc_member<Struct const, Key>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
add_const<typename struct_assoc_member<Struct, Key>::type>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type&
|
||||||
|
call(Struct const& struct_)
|
||||||
|
{
|
||||||
|
return struct_assoc_member<Struct, Key>::call(
|
||||||
|
const_cast<Struct&>(struct_));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
103
include/boost/fusion/adapted/struct/struct_iterator.hpp
Normal file
103
include/boost/fusion/adapted/struct/struct_iterator.hpp
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 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(FUSION_STRUCT_ITERATOR_APRIL_2_2007_1008AM)
|
||||||
|
#define FUSION_STRUCT_ITERATOR_APRIL_2_2007_1008AM
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/extension.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/type_traits/add_reference.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/mpl/minus.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
template <typename Struct, int N_>
|
||||||
|
struct struct_iterator
|
||||||
|
: iterator_facade<struct_iterator<Struct, N_>, random_access_traversal_tag>
|
||||||
|
{
|
||||||
|
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||||
|
BOOST_MPL_ASSERT_RELATION(N_, <=, extension::struct_size<Struct>::value);
|
||||||
|
|
||||||
|
typedef mpl::int_<N_> index;
|
||||||
|
typedef Struct struct_type;
|
||||||
|
|
||||||
|
struct_iterator(Struct& struct_)
|
||||||
|
: struct_(struct_) {}
|
||||||
|
Struct& struct_;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of
|
||||||
|
: extension::struct_member<Struct, N_>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
add_reference<
|
||||||
|
typename extension::struct_member<Struct, N_>::type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return extension::struct_member<Struct, N_>::
|
||||||
|
call(iter.struct_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance
|
||||||
|
{
|
||||||
|
typedef typename Iterator::index index;
|
||||||
|
typedef typename Iterator::struct_type struct_type;
|
||||||
|
typedef struct_iterator<struct_type, index::value + N::value> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return type(iter.struct_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::minus<
|
||||||
|
typename I2::index, typename I1::index
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(I1 const&, I2 const&)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
20
include/boost/fusion/adapted/variant.hpp
Normal file
20
include/boost/fusion/adapted/variant.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_12112006_1614)
|
||||||
|
#define BOOST_FUSION_VARIANT_12112006_1614
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/variant/variant_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/tag_of.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/variant/detail/end_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/variant/detail/begin_impl.hpp
Normal file
45
include/boost/fusion/adapted/variant/detail/begin_impl.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_BEGIN_IMPL_12112006_2137)
|
||||||
|
#define BOOST_FUSION_VARIANT_BEGIN_IMPL_12112006_2137
|
||||||
|
|
||||||
|
#include <boost/mpl/begin.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
template<typename Seq, typename Iterator>
|
||||||
|
struct variant_iterator;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template <typename Seq>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef variant_iterator<
|
||||||
|
Seq,
|
||||||
|
typename mpl::begin<typename Seq::types>::type> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Seq& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,33 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_CATEGORY_OF_IMPL_13112006_0802)
|
||||||
|
#define BOOST_FUSION_VARIANT_CATEGORY_OF_IMPL_13112006_0802
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
struct forward_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef forward_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/variant/detail/end_impl.hpp
Normal file
45
include/boost/fusion/adapted/variant/detail/end_impl.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_END_IMPL_12112006_2137)
|
||||||
|
#define BOOST_FUSION_VARIANT_END_IMPL_12112006_2137
|
||||||
|
|
||||||
|
#include <boost/mpl/end.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
template<typename Seq, typename Iterator>
|
||||||
|
struct variant_iterator;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template <typename Seq>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef variant_iterator<
|
||||||
|
Seq,
|
||||||
|
typename mpl::end<typename Seq::types>::type> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Seq& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_IS_SEQUENCE_IMPL_13112006_0748)
|
||||||
|
#define BOOST_FUSION_VARIANT_IS_SEQUENCE_IMPL_13112006_0748
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
31
include/boost/fusion/adapted/variant/detail/is_view_impl.hpp
Normal file
31
include/boost/fusion/adapted/variant/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_IS_VIEW_IMPL_13112006_0749)
|
||||||
|
#define BOOST_FUSION_VARIANT_IS_VIEW_IMPL_13112006_0749
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::false_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/adapted/variant/detail/size_impl.hpp
Normal file
32
include/boost/fusion/adapted/variant/detail/size_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_SIZE_IMPL_12112006_2115)
|
||||||
|
#define BOOST_FUSION_VARIANT_SIZE_IMPL_12112006_2115
|
||||||
|
|
||||||
|
#include <boost/mpl/size.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct size_impl<variant_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::size<typename Sequence::types>
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
28
include/boost/fusion/adapted/variant/tag_of.hpp
Normal file
28
include/boost/fusion/adapted/variant/tag_of.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_TAG_OF_12112006_1704)
|
||||||
|
#define BOOST_FUSION_VARIANT_TAG_OF_12112006_1704
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
#include <boost/variant/variant_fwd.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct variant_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template<BOOST_VARIANT_ENUM_PARAMS(typename T)>
|
||||||
|
struct tag_of<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
|
||||||
|
{
|
||||||
|
typedef variant_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
117
include/boost/fusion/adapted/variant/variant_iterator.hpp
Normal file
117
include/boost/fusion/adapted/variant/variant_iterator.hpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
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_VARIANT_ITERATOR_12112006_1617)
|
||||||
|
#define BOOST_FUSION_VARIANT_ITERATOR_12112006_1617
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
|
||||||
|
#include <boost/mpl/next.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/mpl/distance.hpp>
|
||||||
|
#include <boost/mpl/deref.hpp>
|
||||||
|
#include <boost/mpl/eval_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/variant/get.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct forward_traversal_tag;
|
||||||
|
|
||||||
|
template<typename Variant, typename MPLIterator>
|
||||||
|
struct variant_iterator
|
||||||
|
: iterator_facade<variant_iterator<Variant, MPLIterator>, forward_traversal_tag>
|
||||||
|
{
|
||||||
|
typedef Variant variant_type;
|
||||||
|
typedef MPLIterator iterator;
|
||||||
|
|
||||||
|
variant_iterator(Variant& var)
|
||||||
|
: var_(var) {}
|
||||||
|
Variant& var_;
|
||||||
|
|
||||||
|
template<typename Iterator>
|
||||||
|
struct next
|
||||||
|
{
|
||||||
|
typedef variant_iterator<
|
||||||
|
typename Iterator::variant_type,
|
||||||
|
typename mpl::next<typename Iterator::iterator>::type> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& i)
|
||||||
|
{
|
||||||
|
return type(i.var_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I1, typename I2>
|
||||||
|
struct distance
|
||||||
|
: mpl::distance<
|
||||||
|
typename I1::iterator,
|
||||||
|
typename I2::iterator>
|
||||||
|
{
|
||||||
|
typedef typename mpl::distance<
|
||||||
|
typename I1::iterator,
|
||||||
|
typename I2::iterator>::type type;
|
||||||
|
|
||||||
|
static type call(I1 const& i1, I2 const& i2)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iterator>
|
||||||
|
struct value_of
|
||||||
|
: mpl::deref<typename Iterator::iterator>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::eval_if<
|
||||||
|
is_const<typename Iterator::variant_type>
|
||||||
|
, add_const<typename mpl::deref<typename Iterator::iterator>::type>
|
||||||
|
, mpl::deref<typename Iterator::iterator>
|
||||||
|
>::type
|
||||||
|
value_type;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
add_reference<value_type>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
|
||||||
|
// for some unknown reason (compiler bug) VC7.1 gets confused with
|
||||||
|
// variant and optional get functions.
|
||||||
|
static type
|
||||||
|
call(Iterator const & it)
|
||||||
|
{
|
||||||
|
boost::detail::variant::get_visitor<type> v;
|
||||||
|
typedef typename mpl::deref<typename Iterator::iterator>::type type;
|
||||||
|
if (type* result = it.var_.apply_visitor(v))
|
||||||
|
return *result;
|
||||||
|
it.var_ = type(); // prime the variant
|
||||||
|
return *it.var_.apply_visitor(v); // no-throw!
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static type
|
||||||
|
call(Iterator const & it)
|
||||||
|
{
|
||||||
|
typedef typename mpl::deref<typename Iterator::iterator>::type type;
|
||||||
|
if (type* result = boost::get<type>(&it.var_))
|
||||||
|
return *result;
|
||||||
|
it.var_ = type(); // prime the variant
|
||||||
|
return *boost::get<type>(&it.var_); // no-throw!
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
14
include/boost/fusion/algorithm.hpp
Normal file
14
include/boost/fusion/algorithm.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ALGORITHM_10022005_0549)
|
||||||
|
#define FUSION_ALGORITHM_10022005_0549
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/iteration.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation.hpp>
|
||||||
|
|
||||||
|
#endif
|
14
include/boost/fusion/algorithm/iteration.hpp
Normal file
14
include/boost/fusion/algorithm/iteration.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ALGORITHM_ITERATION_10022005_0549)
|
||||||
|
#define FUSION_ALGORITHM_ITERATION_10022005_0549
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
|
||||||
|
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||||
|
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||||
|
|
||||||
|
#endif
|
40
include/boost/fusion/algorithm/iteration/accumulate.hpp
Normal file
40
include/boost/fusion/algorithm/iteration/accumulate.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ACCUMULATE_09172005_1032)
|
||||||
|
#define FUSION_ACCUMULATE_09172005_1032
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct void_;
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
struct accumulate
|
||||||
|
: result_of::fold<Sequence, State, F>
|
||||||
|
{};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
inline typename result_of::accumulate<Sequence, State, F>::type
|
||||||
|
accumulate(Sequence& seq, State const& state, F f)
|
||||||
|
{
|
||||||
|
return fusion::fold(seq, state, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
inline typename result_of::accumulate<Sequence const, State, F>::type
|
||||||
|
accumulate(Sequence const& seq, State const& state, F f)
|
||||||
|
{
|
||||||
|
return fusion::fold(seq, state, f);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
271
include/boost/fusion/algorithm/iteration/detail/fold.hpp
Normal file
271
include/boost/fusion/algorithm/iteration/detail/fold.hpp
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
#if !defined(BOOST_FUSION_FOLD_HPP_20070528_1253)
|
||||||
|
#define BOOST_FUSION_FOLD_HPP_20070528_1253
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
#include <boost/mpl/apply.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
#include <boost/fusion/iterator/value_of.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
#include <boost/utility/result_of.hpp>
|
||||||
|
|
||||||
|
#include <boost/type_traits/add_const.hpp>
|
||||||
|
#include <boost/type_traits/add_reference.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
struct fold;
|
||||||
|
}
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename F>
|
||||||
|
struct apply_fold_result
|
||||||
|
{
|
||||||
|
template <typename Value, typename State>
|
||||||
|
struct apply
|
||||||
|
: boost::result_of<F(Value,State)>
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename State, typename F>
|
||||||
|
struct fold_apply
|
||||||
|
{
|
||||||
|
typedef typename result_of::deref<Iterator>::type dereferenced;
|
||||||
|
typedef typename add_reference<typename add_const<State>::type>::type lvalue_state;
|
||||||
|
typedef typename boost::result_of<F(dereferenced, lvalue_state)>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename State, typename F>
|
||||||
|
struct static_fold;
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename State, typename F>
|
||||||
|
struct next_result_of_fold
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
static_fold<
|
||||||
|
typename result_of::next<First>::type
|
||||||
|
, Last
|
||||||
|
, typename fold_apply<First, State, F>::type
|
||||||
|
, F
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename State, typename F>
|
||||||
|
struct static_fold
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
result_of::equal_to<First, Last>
|
||||||
|
, mpl::identity<State>
|
||||||
|
, next_result_of_fold<First, Last, State, F>
|
||||||
|
>::type
|
||||||
|
result;
|
||||||
|
|
||||||
|
typedef typename result::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F, int N>
|
||||||
|
struct result_of_unrolled_fold;
|
||||||
|
|
||||||
|
template<int N>
|
||||||
|
struct unrolled_fold
|
||||||
|
{
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
static typename result_of_unrolled_fold<I0, State, F, N>::type
|
||||||
|
call(I0 const& i0, State const& state, F f)
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1 = fusion::next(i0);
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2 = fusion::next(i1);
|
||||||
|
typedef typename result_of::next<I2>::type I3;
|
||||||
|
I3 i3 = fusion::next(i2);
|
||||||
|
typedef typename result_of::next<I3>::type I4;
|
||||||
|
I4 i4 = fusion::next(i3);
|
||||||
|
|
||||||
|
return unrolled_fold<N-4>::call(i4, f(*i3, f(*i2, f(*i1, f(*i0, state)))), f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_fold<3>
|
||||||
|
{
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
static typename result_of_unrolled_fold<I0, State, F, 3>::type
|
||||||
|
call(I0 const& i0, State const& state, F f)
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1 = fusion::next(i0);
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2 = fusion::next(i1);
|
||||||
|
return f(*i2, f(*i1, f(*i0, state)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_fold<2>
|
||||||
|
{
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
static typename result_of_unrolled_fold<I0, State, F, 2>::type
|
||||||
|
call(I0 const& i0, State const& state, F f)
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1 = fusion::next(i0);
|
||||||
|
return f(*i1, f(*i0, state));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_fold<1>
|
||||||
|
{
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
static typename result_of_unrolled_fold<I0, State, F, 1>::type
|
||||||
|
call(I0 const& i0, State const& state, F f)
|
||||||
|
{
|
||||||
|
return f(*i0, state);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_fold<0>
|
||||||
|
{
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
static State call(I0 const&, State const& state, F)
|
||||||
|
{
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// terminal case
|
||||||
|
template <typename First, typename Last, typename State, typename F>
|
||||||
|
inline State const&
|
||||||
|
linear_fold(First const&, Last const&, State const& state, F, mpl::true_)
|
||||||
|
{
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// non-terminal case
|
||||||
|
template <typename First, typename Last, typename State, typename F>
|
||||||
|
inline typename static_fold<First, Last, State, F>::type
|
||||||
|
linear_fold(
|
||||||
|
First const& first
|
||||||
|
, Last const& last
|
||||||
|
, State const& state
|
||||||
|
, F f
|
||||||
|
, mpl::false_)
|
||||||
|
{
|
||||||
|
return detail::linear_fold(
|
||||||
|
fusion::next(first)
|
||||||
|
, last
|
||||||
|
, f(*first, state)
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<typename result_of::next<First>::type, Last>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F, int N>
|
||||||
|
struct result_of_unrolled_fold
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
typedef typename result_of::next<I2>::type I3;
|
||||||
|
typedef typename result_of::next<I3>::type I4;
|
||||||
|
typedef typename fold_apply<I0, State, F>::type Rest1;
|
||||||
|
typedef typename fold_apply<I1, Rest1, F>::type Rest2;
|
||||||
|
typedef typename fold_apply<I2, Rest2, F>::type Rest3;
|
||||||
|
typedef typename fold_apply<I3, Rest3, F>::type Rest4;
|
||||||
|
|
||||||
|
typedef typename result_of_unrolled_fold<I4, Rest4, F, N-4>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
struct result_of_unrolled_fold<I0, State, F, 3>
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
typedef typename fold_apply<I0, State, F>::type Rest;
|
||||||
|
typedef typename fold_apply<I1, Rest, F>::type Rest2;
|
||||||
|
typedef typename fold_apply<I2, Rest2, F>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
struct result_of_unrolled_fold<I0, State, F, 2>
|
||||||
|
{
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
typedef typename fold_apply<I0, State, F>::type Rest;
|
||||||
|
typedef typename fold_apply<I1, Rest, F>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
struct result_of_unrolled_fold<I0, State, F, 1>
|
||||||
|
{
|
||||||
|
typedef typename fold_apply<I0, State, F>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename I0, typename State, typename F>
|
||||||
|
struct result_of_unrolled_fold<I0, State, F, 0>
|
||||||
|
{
|
||||||
|
typedef State type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename State, typename F, bool>
|
||||||
|
struct choose_fold;
|
||||||
|
|
||||||
|
template<typename Sequence, typename State, typename F>
|
||||||
|
struct choose_fold<Sequence, State, F, true>
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
typedef typename result_of_unrolled_fold<
|
||||||
|
begin, State, F, result_of::distance<begin, end>::type::value>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename State, typename F>
|
||||||
|
struct choose_fold<Sequence, State, F, false>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
detail::static_fold<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type
|
||||||
|
, State
|
||||||
|
, F
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename State, typename F, typename Tag>
|
||||||
|
typename result_of::fold<Sequence, State, F>::type
|
||||||
|
fold(Sequence& seq, State const& state, F f, Tag)
|
||||||
|
{
|
||||||
|
return linear_fold(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, fusion::end(seq)
|
||||||
|
, state
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Sequence, typename State, typename F>
|
||||||
|
typename result_of::fold<Sequence, State, F>::type
|
||||||
|
fold(Sequence& seq, State const& state, F f, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
return unrolled_fold<result_of::distance<begin, end>::type::value>::call(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, state
|
||||||
|
, f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
130
include/boost/fusion/algorithm/iteration/detail/for_each.hpp
Normal file
130
include/boost/fusion/algorithm/iteration/detail/for_each.hpp
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_FOR_EACH_05052005_1028)
|
||||||
|
#define FUSION_FOR_EACH_05052005_1028
|
||||||
|
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline void
|
||||||
|
for_each_linear(First const&, Last const&, F const&, mpl::true_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline void
|
||||||
|
for_each_linear(First const& first, Last const& last, F const& f, mpl::false_)
|
||||||
|
{
|
||||||
|
f(*first);
|
||||||
|
detail::for_each_linear(fusion::next(first), last, f,
|
||||||
|
result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Sequence, typename F, typename Tag>
|
||||||
|
inline void
|
||||||
|
for_each(Sequence& seq, F const& f, Tag)
|
||||||
|
{
|
||||||
|
detail::for_each_linear(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, fusion::end(seq)
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N>
|
||||||
|
struct for_each_unrolled
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static void call(I0 const& i0, F const& f)
|
||||||
|
{
|
||||||
|
f(*i0);
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
f(*i1);
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2(fusion::next(i1));
|
||||||
|
f(*i2);
|
||||||
|
typedef typename result_of::next<I2>::type I3;
|
||||||
|
I3 i3(fusion::next(i2));
|
||||||
|
f(*i3);
|
||||||
|
for_each_unrolled<N-4>::call(fusion::next(i3), f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct for_each_unrolled<3>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static void call(I0 const& i0, F const& f)
|
||||||
|
{
|
||||||
|
f(*i0);
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
f(*i1);
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2(fusion::next(i1));
|
||||||
|
f(*i2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct for_each_unrolled<2>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static void call(I0 const& i0, F const& f)
|
||||||
|
{
|
||||||
|
f(*i0);
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
f(*i1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct for_each_unrolled<1>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static void call(I0 const& i0, F const& f)
|
||||||
|
{
|
||||||
|
f(*i0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct for_each_unrolled<0>
|
||||||
|
{
|
||||||
|
template<typename It, typename F>
|
||||||
|
static void call(It const&, F const&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline void
|
||||||
|
for_each(Sequence& seq, F const& f, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
for_each_unrolled<result_of::distance<begin, end>::type::value>::call(fusion::begin(seq), f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
91
include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp
Executable file
91
include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_FOR_EACH_S_05022006_1027)
|
||||||
|
#define FUSION_FOR_EACH_S_05022006_1027
|
||||||
|
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
|
||||||
|
#include <boost/fusion/support/ext_/is_segmented.hpp>
|
||||||
|
|
||||||
|
// fwd declarations
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
void
|
||||||
|
for_each_s(Sequence& seq, F const& f);
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
void
|
||||||
|
for_each_s(Sequence const& seq, F const& f);
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template<typename F>
|
||||||
|
struct for_each_s_bind
|
||||||
|
{
|
||||||
|
explicit for_each_s_bind(F const &f)
|
||||||
|
: f_(f)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<typename Sequence>
|
||||||
|
void operator ()(Sequence &seq) const
|
||||||
|
{
|
||||||
|
fusion::for_each_s(seq, this->f_);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Sequence>
|
||||||
|
void operator ()(Sequence const &seq) const
|
||||||
|
{
|
||||||
|
fusion::for_each_s(seq, this->f_);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
F const &f_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename F>
|
||||||
|
void for_each_s(Sequence &seq, F const &f, mpl::true_)
|
||||||
|
{
|
||||||
|
fusion::for_each_s(fusion::segments(seq), for_each_s_bind<F>(f));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Sequence, typename F>
|
||||||
|
void for_each_s(Sequence &seq, F const &f, mpl::false_)
|
||||||
|
{
|
||||||
|
fusion::for_each(seq, f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct for_each_s
|
||||||
|
{
|
||||||
|
typedef void type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline void
|
||||||
|
for_each_s(Sequence& seq, F const& f)
|
||||||
|
{
|
||||||
|
detail::for_each_s(seq, f, traits::is_segmented<Sequence>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline void
|
||||||
|
for_each_s(Sequence const& seq, F const& f)
|
||||||
|
{
|
||||||
|
detail::for_each_s(seq, f, traits::is_segmented<Sequence>());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
48
include/boost/fusion/algorithm/iteration/fold.hpp
Normal file
48
include/boost/fusion/algorithm/iteration/fold.hpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_FOLD_05052005_1214)
|
||||||
|
#define BOOST_FUSION_FOLD_05052005_1214
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
|
||||||
|
#include <boost/type_traits/is_base_of.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
struct fold
|
||||||
|
: fusion::detail::choose_fold<
|
||||||
|
Sequence, State, F
|
||||||
|
, is_base_of<random_access_traversal_tag, typename traits::category_of<Sequence>::type>::value>
|
||||||
|
{};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
inline typename result_of::fold<Sequence, State, F>::type
|
||||||
|
fold(Sequence& seq, State const& state, F f)
|
||||||
|
{
|
||||||
|
return detail::fold(seq, state, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename State, typename F>
|
||||||
|
inline typename result_of::fold<Sequence const, State, F>::type
|
||||||
|
fold(Sequence const& seq, State const& state, F f)
|
||||||
|
{
|
||||||
|
return detail::fold(seq, state, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
43
include/boost/fusion/algorithm/iteration/for_each.hpp
Normal file
43
include/boost/fusion/algorithm/iteration/for_each.hpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2007 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_FOR_EACH_20070527_0943)
|
||||||
|
#define BOOST_FUSION_FOR_EACH_20070527_0943
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/iteration/detail/for_each.hpp>
|
||||||
|
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct for_each
|
||||||
|
{
|
||||||
|
typedef void type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline void
|
||||||
|
for_each(Sequence& seq, F const& f)
|
||||||
|
{
|
||||||
|
detail::for_each(seq, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline void
|
||||||
|
for_each(Sequence const& seq, F const& f)
|
||||||
|
{
|
||||||
|
detail::for_each(seq, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
18
include/boost/fusion/algorithm/query.hpp
Normal file
18
include/boost/fusion/algorithm/query.hpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ALGORITHM_QUERY_10022005_0549)
|
||||||
|
#define FUSION_ALGORITHM_QUERY_10022005_0549
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/all.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/any.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/count.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/count_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/find.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/none.hpp>
|
||||||
|
|
||||||
|
#endif
|
34
include/boost/fusion/algorithm/query/all.hpp
Normal file
34
include/boost/fusion/algorithm/query/all.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_ALL_05052005_1238)
|
||||||
|
#define BOOST_FUSION_ALL_05052005_1238
|
||||||
|
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/detail/all.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct all
|
||||||
|
{
|
||||||
|
typedef bool type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline bool
|
||||||
|
all(Sequence const& seq, F f)
|
||||||
|
{
|
||||||
|
return detail::all(seq, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
35
include/boost/fusion/algorithm/query/any.hpp
Normal file
35
include/boost/fusion/algorithm/query/any.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2005 Eric Niebler
|
||||||
|
Copyright (c) 2007 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(FUSION_ANY_05052005_1230)
|
||||||
|
#define FUSION_ANY_05052005_1230
|
||||||
|
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/detail/any.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct any
|
||||||
|
{
|
||||||
|
typedef bool type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline bool
|
||||||
|
any(Sequence const& seq, F f)
|
||||||
|
{
|
||||||
|
return detail::any(seq, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
35
include/boost/fusion/algorithm/query/count.hpp
Normal file
35
include/boost/fusion/algorithm/query/count.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007
|
||||||
|
|
||||||
|
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_COUNT_09162005_0150)
|
||||||
|
#define BOOST_FUSION_COUNT_09162005_0150
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/count_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/detail/count.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct count
|
||||||
|
{
|
||||||
|
typedef int type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename T>
|
||||||
|
inline int
|
||||||
|
count(Sequence const& seq, T const& x)
|
||||||
|
{
|
||||||
|
detail::count_compare<T> f(x);
|
||||||
|
return fusion::count_if(seq, f);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
35
include/boost/fusion/algorithm/query/count_if.hpp
Normal file
35
include/boost/fusion/algorithm/query/count_if.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_COUNT_IF_09162005_0137)
|
||||||
|
#define BOOST_FUSION_COUNT_IF_09162005_0137
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct count_if
|
||||||
|
{
|
||||||
|
typedef int type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline int
|
||||||
|
count_if(Sequence const& seq, F f)
|
||||||
|
{
|
||||||
|
return detail::count_if(
|
||||||
|
seq, f, typename traits::category_of<Sequence>::type());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
127
include/boost/fusion/algorithm/query/detail/all.hpp
Normal file
127
include/boost/fusion/algorithm/query/detail/all.hpp
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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(FUSION_ALL_05052005_1237)
|
||||||
|
#define FUSION_ALL_05052005_1237
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline bool
|
||||||
|
linear_all(First const&, Last const&, F const&, mpl::true_)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline bool
|
||||||
|
linear_all(First const& first, Last const& last, F& f, mpl::false_)
|
||||||
|
{
|
||||||
|
typename result_of::deref<First>::type x = *first;
|
||||||
|
return f(x) &&
|
||||||
|
detail::linear_all(
|
||||||
|
fusion::next(first)
|
||||||
|
, last
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F, typename Tag>
|
||||||
|
inline bool
|
||||||
|
all(Sequence const& seq, F f, Tag)
|
||||||
|
{
|
||||||
|
return detail::linear_all(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, fusion::end(seq)
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N>
|
||||||
|
struct unrolled_all
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) &&
|
||||||
|
f(*fusion::advance_c<1>(it))&&
|
||||||
|
f(*fusion::advance_c<2>(it)) &&
|
||||||
|
f(*fusion::advance_c<3>(it)) &&
|
||||||
|
detail::unrolled_all<N-4>::call(fusion::advance_c<4>(it), f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_all<3>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) &&
|
||||||
|
f(*fusion::advance_c<1>(it)) &&
|
||||||
|
f(*fusion::advance_c<2>(it));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_all<2>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) &&
|
||||||
|
f(*fusion::advance_c<1>(it));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_all<1>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return f(*it);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_all<0>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline bool
|
||||||
|
all(Sequence const& seq, F f, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
return detail::unrolled_all<result_of::distance<begin, end>::type::value>::call(
|
||||||
|
fusion::begin(seq), f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
130
include/boost/fusion/algorithm/query/detail/any.hpp
Normal file
130
include/boost/fusion/algorithm/query/detail/any.hpp
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2005 Eric Niebler
|
||||||
|
Copyright (c) 2007 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(FUSION_ANY_05052005_1229)
|
||||||
|
#define FUSION_ANY_05052005_1229
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline bool
|
||||||
|
linear_any(First const&, Last const&, F const&, mpl::true_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline bool
|
||||||
|
linear_any(First const& first, Last const& last, F& f, mpl::false_)
|
||||||
|
{
|
||||||
|
typename result_of::deref<First>::type x = *first;
|
||||||
|
return f(x) ||
|
||||||
|
detail::linear_any(
|
||||||
|
fusion::next(first)
|
||||||
|
, last
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F, typename Tag>
|
||||||
|
inline bool
|
||||||
|
any(Sequence const& seq, F f, Tag)
|
||||||
|
{
|
||||||
|
return detail::linear_any(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, fusion::end(seq)
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N>
|
||||||
|
struct unrolled_any
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) ||
|
||||||
|
f(*fusion::advance_c<1>(it))||
|
||||||
|
f(*fusion::advance_c<2>(it)) ||
|
||||||
|
f(*fusion::advance_c<3>(it)) ||
|
||||||
|
detail::unrolled_any<N-4>::call(fusion::advance_c<4>(it), f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_any<3>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) ||
|
||||||
|
f(*fusion::advance_c<1>(it)) ||
|
||||||
|
f(*fusion::advance_c<2>(it));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_any<2>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
f(*it) ||
|
||||||
|
f(*fusion::advance_c<1>(it));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_any<1>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return f(*it);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_any<0>
|
||||||
|
{
|
||||||
|
template <typename It, typename F>
|
||||||
|
static bool call(It const& it, F f)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline bool
|
||||||
|
any(Sequence const& seq, F f, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
return detail::unrolled_any<result_of::distance<begin, end>::type::value>::call(
|
||||||
|
fusion::begin(seq), f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
35
include/boost/fusion/algorithm/query/detail/assoc_find.hpp
Normal file
35
include/boost/fusion/algorithm/query/detail/assoc_find.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ASSOC_FIND_09242005_1133)
|
||||||
|
#define FUSION_ASSOC_FIND_09242005_1133
|
||||||
|
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Key>
|
||||||
|
struct assoc_find
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<Sequence>
|
||||||
|
, typename Sequence::template meta_find_impl_const<Key>::type
|
||||||
|
, typename Sequence::template meta_find_impl<Key>::type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& s)
|
||||||
|
{
|
||||||
|
return s.find_impl(mpl::identity<Key>());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
68
include/boost/fusion/algorithm/query/detail/count.hpp
Normal file
68
include/boost/fusion/algorithm/query/detail/count.hpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_COUNT_09162005_0158)
|
||||||
|
#define FUSION_COUNT_09162005_0158
|
||||||
|
|
||||||
|
#include <boost/mpl/or.hpp>
|
||||||
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
#include <boost/fusion/support/detail/access.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <bool is_convertible>
|
||||||
|
struct compare_convertible;
|
||||||
|
|
||||||
|
// T1 is convertible to T2 or vice versa
|
||||||
|
template <>
|
||||||
|
struct compare_convertible<true>
|
||||||
|
{
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
static bool
|
||||||
|
call(T1 const& x, T2 const& y)
|
||||||
|
{
|
||||||
|
return x == y;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// T1 is NOT convertible to T2 NOR vice versa
|
||||||
|
template <>
|
||||||
|
struct compare_convertible<false>
|
||||||
|
{
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
static bool
|
||||||
|
call(T1 const&, T2 const&)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T1>
|
||||||
|
struct count_compare
|
||||||
|
{
|
||||||
|
typedef typename detail::call_param<T1>::type param;
|
||||||
|
count_compare(param x)
|
||||||
|
: x(x) {}
|
||||||
|
|
||||||
|
template <typename T2>
|
||||||
|
bool
|
||||||
|
operator()(T2 const& y)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
compare_convertible<
|
||||||
|
mpl::or_<
|
||||||
|
is_convertible<T1, T2>
|
||||||
|
, is_convertible<T2, T1>
|
||||||
|
>::value
|
||||||
|
>::call(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
param x;
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
170
include/boost/fusion/algorithm/query/detail/count_if.hpp
Normal file
170
include/boost/fusion/algorithm/query/detail/count_if.hpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_COUNT_IF_09162005_0141)
|
||||||
|
#define BOOST_FUSION_COUNT_IF_09162005_0141
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline int
|
||||||
|
linear_count_if(First const&, Last const&, F const&, mpl::true_)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename F>
|
||||||
|
inline int
|
||||||
|
linear_count_if(First const& first, Last const& last, F& f, mpl::false_)
|
||||||
|
{
|
||||||
|
int n =
|
||||||
|
detail::linear_count_if(
|
||||||
|
fusion::next(first)
|
||||||
|
, last
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||||
|
if (f(*first))
|
||||||
|
++n;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F, typename Tag>
|
||||||
|
inline int
|
||||||
|
count_if(Sequence const& seq, F f, Tag)
|
||||||
|
{
|
||||||
|
return detail::linear_count_if(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, fusion::end(seq)
|
||||||
|
, f
|
||||||
|
, result_of::equal_to<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int n>
|
||||||
|
struct unrolled_count_if
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static int call(I0 const& i0, F f)
|
||||||
|
{
|
||||||
|
int ct = unrolled_count_if<n-4>::
|
||||||
|
call(fusion::advance_c<4>(i0), f);
|
||||||
|
if(f(*i0))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
if(f(*i1))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2(fusion::next(i1));
|
||||||
|
if(f(*i2))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I2>::type I3;
|
||||||
|
I3 i3(fusion::next(i2));
|
||||||
|
if(f(*i3))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_count_if<3>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static int call(I0 const& i0, F f)
|
||||||
|
{
|
||||||
|
int ct = 0;
|
||||||
|
if(f(*i0))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
if(f(*i1))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I1>::type I2;
|
||||||
|
I2 i2(fusion::next(i1));
|
||||||
|
if(f(*i2))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_count_if<2>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static int call(I0 const& i0, F f)
|
||||||
|
{
|
||||||
|
int ct = 0;
|
||||||
|
|
||||||
|
if(f(*i0))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
typedef typename result_of::next<I0>::type I1;
|
||||||
|
I1 i1(fusion::next(i0));
|
||||||
|
if(f(*i1))
|
||||||
|
++ct;
|
||||||
|
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_count_if<1>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static int call(I0 const& i0, F f)
|
||||||
|
{
|
||||||
|
int ct = 0;
|
||||||
|
if(f(*i0))
|
||||||
|
++ct;
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct unrolled_count_if<0>
|
||||||
|
{
|
||||||
|
template<typename I0, typename F>
|
||||||
|
static int call(I0 const&, F)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline int
|
||||||
|
count_if(Sequence const& seq, F f, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type begin;
|
||||||
|
typedef typename result_of::end<Sequence>::type end;
|
||||||
|
return detail::unrolled_count_if<result_of::distance<begin, end>::type::value>::
|
||||||
|
call(fusion::begin(seq), f);
|
||||||
|
}
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
252
include/boost/fusion/algorithm/query/detail/find_if.hpp
Normal file
252
include/boost/fusion/algorithm/query/detail/find_if.hpp
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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(FUSION_FIND_IF_05052005_1107)
|
||||||
|
#define FUSION_FIND_IF_05052005_1107
|
||||||
|
|
||||||
|
#include <boost/mpl/eval_if.hpp>
|
||||||
|
#include <boost/mpl/or.hpp>
|
||||||
|
#include <boost/mpl/lambda.hpp>
|
||||||
|
#include <boost/mpl/apply.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
#include <boost/fusion/iterator/value_of.hpp>
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
#include <boost/mpl/eval_if.hpp>
|
||||||
|
#include <boost/mpl/identity.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename Iterator, typename Pred>
|
||||||
|
struct apply_filter
|
||||||
|
{
|
||||||
|
typedef typename mpl::apply1<
|
||||||
|
Pred, typename result_of::value_of<Iterator>::type>::type type;
|
||||||
|
BOOST_STATIC_CONSTANT(int, value = type::value);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename Pred>
|
||||||
|
struct main_find_if;
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename Pred>
|
||||||
|
struct recursive_find_if
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
main_find_if<
|
||||||
|
typename result_of::next<First>::type, Last, Pred
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename Pred>
|
||||||
|
struct main_find_if
|
||||||
|
{
|
||||||
|
typedef mpl::or_<
|
||||||
|
result_of::equal_to<First, Last>
|
||||||
|
, apply_filter<First, Pred> >
|
||||||
|
filter;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
mpl::eval_if<
|
||||||
|
filter
|
||||||
|
, mpl::identity<First>
|
||||||
|
, recursive_find_if<First, Last, Pred>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename First, typename Last,
|
||||||
|
typename Pred, bool>
|
||||||
|
struct choose_find_if;
|
||||||
|
|
||||||
|
template<typename First, typename Last, typename Pred>
|
||||||
|
struct choose_find_if<First, Last, Pred, false>
|
||||||
|
: main_find_if<First, Last, Pred>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred, int n, int unrolling>
|
||||||
|
struct unroll_again;
|
||||||
|
|
||||||
|
template <typename Iter, typename Pred, int offset>
|
||||||
|
struct apply_offset_filter
|
||||||
|
{
|
||||||
|
typedef typename result_of::advance_c<Iter, offset>::type Shifted;
|
||||||
|
typedef typename
|
||||||
|
mpl::apply1<
|
||||||
|
Pred
|
||||||
|
, typename result_of::value_of<Shifted>::type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
BOOST_STATIC_CONSTANT(int, value = type::value);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred, int n>
|
||||||
|
struct unrolled_find_if
|
||||||
|
{
|
||||||
|
typedef typename mpl::eval_if<
|
||||||
|
apply_filter<Iter, Pred>,
|
||||||
|
mpl::identity<Iter>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 1>,
|
||||||
|
result_of::advance_c<Iter, 1>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 2>,
|
||||||
|
result_of::advance_c<Iter, 2>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 3>,
|
||||||
|
result_of::advance_c<Iter, 3>,
|
||||||
|
unroll_again<
|
||||||
|
Iter,
|
||||||
|
Pred,
|
||||||
|
n,
|
||||||
|
4> > > > >::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred>
|
||||||
|
struct unrolled_find_if<Iter, Pred, 3>
|
||||||
|
{
|
||||||
|
typedef typename mpl::eval_if<
|
||||||
|
apply_filter<Iter, Pred>,
|
||||||
|
mpl::identity<Iter>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 1>,
|
||||||
|
result_of::advance_c<Iter, 1>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 2>,
|
||||||
|
result_of::advance_c<Iter, 2>,
|
||||||
|
result_of::advance_c<Iter, 3> > > >::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred>
|
||||||
|
struct unrolled_find_if<Iter, Pred, 2>
|
||||||
|
{
|
||||||
|
typedef typename mpl::eval_if<
|
||||||
|
apply_filter<Iter, Pred>,
|
||||||
|
mpl::identity<Iter>,
|
||||||
|
mpl::eval_if<
|
||||||
|
apply_offset_filter<Iter, Pred, 1>,
|
||||||
|
result_of::advance_c<Iter, 1>,
|
||||||
|
result_of::advance_c<Iter, 2> > >::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred>
|
||||||
|
struct unrolled_find_if<Iter, Pred, 1>
|
||||||
|
{
|
||||||
|
typedef typename mpl::eval_if<
|
||||||
|
apply_filter<Iter, Pred>,
|
||||||
|
mpl::identity<Iter>,
|
||||||
|
result_of::advance_c<Iter, 1> >::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred, int n, int unrolling>
|
||||||
|
struct unroll_again
|
||||||
|
{
|
||||||
|
typedef typename unrolled_find_if<
|
||||||
|
typename result_of::advance_c<Iter, unrolling>::type,
|
||||||
|
Pred,
|
||||||
|
n-unrolling>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Iter, typename Pred>
|
||||||
|
struct unrolled_find_if<Iter, Pred, 0>
|
||||||
|
{
|
||||||
|
typedef Iter type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename First, typename Last, typename Pred>
|
||||||
|
struct choose_find_if<First, Last, Pred, true>
|
||||||
|
{
|
||||||
|
typedef typename result_of::distance<First, Last>::type N;
|
||||||
|
typedef typename unrolled_find_if<First, Pred, N::value>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename Pred>
|
||||||
|
struct static_find_if
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
choose_find_if<
|
||||||
|
First
|
||||||
|
, Last
|
||||||
|
, typename mpl::lambda<Pred>::type
|
||||||
|
, is_base_of<random_access_traversal_tag, typename traits::category_of<First>::type>::value
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
static type
|
||||||
|
recursive_call(Iterator const& iter, mpl::true_)
|
||||||
|
{
|
||||||
|
return iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
static type
|
||||||
|
recursive_call(Iterator const& iter, mpl::false_)
|
||||||
|
{
|
||||||
|
return recursive_call(fusion::next(iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
static type
|
||||||
|
recursive_call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
typedef result_of::equal_to<Iterator, type> found;
|
||||||
|
return recursive_call(iter, found());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iterator, typename Tag>
|
||||||
|
static type
|
||||||
|
choose_call(Iterator const& iter, Tag)
|
||||||
|
{
|
||||||
|
return recursive_call(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
static type
|
||||||
|
choose_call(Iterator const& iter, random_access_traversal_tag)
|
||||||
|
{
|
||||||
|
typedef typename result_of::distance<Iterator, type>::type N;
|
||||||
|
return fusion::advance<N>(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
static type
|
||||||
|
call(Iterator const& iter)
|
||||||
|
{
|
||||||
|
return choose_call(iter, typename traits::category_of<Iterator>::type());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename First, typename Last, typename Pred>
|
||||||
|
struct static_seq_find_if : static_find_if<First, Last, Pred>
|
||||||
|
{
|
||||||
|
typedef typename static_find_if<First, Last, Pred>::type type;
|
||||||
|
|
||||||
|
template <typename Sequence>
|
||||||
|
static type
|
||||||
|
call(Sequence const& seq)
|
||||||
|
{
|
||||||
|
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence>
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
222
include/boost/fusion/algorithm/query/ext_/find_if_s.hpp
Executable file
222
include/boost/fusion/algorithm/query/ext_/find_if_s.hpp
Executable file
@ -0,0 +1,222 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FIND_IF_S_05152006_1027)
|
||||||
|
#define FIND_IF_S_05152006_1027
|
||||||
|
|
||||||
|
#include <boost/mpl/not.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/eval_if.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||||
|
#include <boost/fusion/container/list/cons.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
|
||||||
|
#include <boost/fusion/view/ext_/segmented_iterator.hpp>
|
||||||
|
#include <boost/fusion/view/ext_/segmented_iterator_range.hpp>
|
||||||
|
#include <boost/fusion/support/ext_/is_segmented.hpp>
|
||||||
|
|
||||||
|
// fwd declarations
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template<typename Sequence, typename Pred, bool IsSegmented = traits::is_segmented<Sequence>::value>
|
||||||
|
struct static_find_if_s_recurse;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Pred>
|
||||||
|
struct find_if_s;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename Sequence, typename Where, bool IsSegmented = traits::is_segmented<Sequence>::value>
|
||||||
|
struct is_found
|
||||||
|
: mpl::not_<result_of::equal_to<Where, typename result_of::end<Sequence>::type> >
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Sequence, typename Cons>
|
||||||
|
struct is_found<Sequence, Cons, true>
|
||||||
|
: mpl::not_<is_same<nil, Cons> >
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename SegmentedRange
|
||||||
|
, typename Where
|
||||||
|
, typename Sequence = typename remove_reference<
|
||||||
|
typename result_of::deref<
|
||||||
|
typename SegmentedRange::iterator_type
|
||||||
|
>::type
|
||||||
|
>::type
|
||||||
|
, bool IsSegmented = traits::is_segmented<Sequence>::value
|
||||||
|
>
|
||||||
|
struct as_segmented_cons
|
||||||
|
{
|
||||||
|
typedef cons<
|
||||||
|
SegmentedRange
|
||||||
|
, cons<segmented_range<Sequence, Where, false> >
|
||||||
|
> type;
|
||||||
|
|
||||||
|
static type call(SegmentedRange const &range, Where const &where)
|
||||||
|
{
|
||||||
|
return fusion::make_cons(
|
||||||
|
range
|
||||||
|
, fusion::make_cons(
|
||||||
|
segmented_range<Sequence, Where, false>(*fusion::begin(range), where)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename SegmentedRange
|
||||||
|
, typename Where
|
||||||
|
, typename Sequence
|
||||||
|
>
|
||||||
|
struct as_segmented_cons<SegmentedRange, Where, Sequence, true>
|
||||||
|
{
|
||||||
|
typedef cons<SegmentedRange, Where> type;
|
||||||
|
|
||||||
|
static type call(SegmentedRange const &range, Where const &where)
|
||||||
|
{
|
||||||
|
return fusion::make_cons(range, where);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename SegmentedRange
|
||||||
|
, typename Pred
|
||||||
|
, bool IsEmpty = is_empty<SegmentedRange>::value
|
||||||
|
>
|
||||||
|
struct static_find_if_s_seg
|
||||||
|
{
|
||||||
|
typedef typename SegmentedRange::iterator_type first;
|
||||||
|
typedef typename result_of::deref<first>::type segment_ref;
|
||||||
|
typedef typename remove_reference<segment_ref>::type segment;
|
||||||
|
typedef static_find_if_s_recurse<segment, Pred> where;
|
||||||
|
typedef range_next<SegmentedRange> next;
|
||||||
|
typedef is_found<segment, typename where::type> is_found;
|
||||||
|
typedef as_segmented_cons<SegmentedRange, typename where::type> found;
|
||||||
|
typedef static_find_if_s_seg<typename next::type, Pred> not_found;
|
||||||
|
typedef typename mpl::eval_if<is_found, found, not_found>::type type;
|
||||||
|
|
||||||
|
static type call(SegmentedRange const &range)
|
||||||
|
{
|
||||||
|
return call_(range, is_found());
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static type call_(SegmentedRange const &range, mpl::true_)
|
||||||
|
{
|
||||||
|
return found::call(range, where::call(*range.where));
|
||||||
|
}
|
||||||
|
|
||||||
|
static type call_(SegmentedRange const &range, mpl::false_)
|
||||||
|
{
|
||||||
|
return not_found::call(next::call(range));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename SegmentedRange
|
||||||
|
, typename Pred
|
||||||
|
>
|
||||||
|
struct static_find_if_s_seg<SegmentedRange, Pred, true>
|
||||||
|
{
|
||||||
|
typedef nil type;
|
||||||
|
|
||||||
|
static type call(SegmentedRange const &)
|
||||||
|
{
|
||||||
|
return nil();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename Pred>
|
||||||
|
struct static_find_if_s_recurse<Sequence, Pred, true>
|
||||||
|
{
|
||||||
|
typedef typename as_segmented_range<Sequence>::type range;
|
||||||
|
typedef static_find_if_s_seg<range, Pred> find_if;
|
||||||
|
typedef typename find_if::type type;
|
||||||
|
|
||||||
|
static type call(Sequence &seq)
|
||||||
|
{
|
||||||
|
return find_if::call(range(fusion::segments(seq)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename Pred>
|
||||||
|
struct static_find_if_s_recurse<Sequence, Pred, false>
|
||||||
|
{
|
||||||
|
typedef typename result_of::find_if<Sequence, Pred>::type type;
|
||||||
|
|
||||||
|
static type call(Sequence &seq)
|
||||||
|
{
|
||||||
|
return fusion::find_if<Pred>(seq);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence, typename Pred, bool IsSegmented = traits::is_segmented<Sequence>::value>
|
||||||
|
struct static_find_if_s
|
||||||
|
: static_find_if_s_recurse<Sequence, Pred, IsSegmented>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<typename Sequence, typename Pred>
|
||||||
|
struct static_find_if_s<Sequence, Pred, true>
|
||||||
|
{
|
||||||
|
typedef typename as_segmented_range<Sequence>::type range;
|
||||||
|
typedef static_find_if_s_recurse<Sequence, Pred> find_if;
|
||||||
|
typedef typename find_if::type found;
|
||||||
|
|
||||||
|
typedef segmented_iterator<typename reverse_cons<found>::type> type;
|
||||||
|
|
||||||
|
static type call(Sequence &seq)
|
||||||
|
{
|
||||||
|
return type(reverse_cons<found>::call(find_if::call(seq)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Pred>
|
||||||
|
struct find_if_s
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
detail::static_find_if_s<
|
||||||
|
Sequence
|
||||||
|
, Pred
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Pred, typename Sequence>
|
||||||
|
typename lazy_disable_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, result_of::find_if_s<Sequence, Pred>
|
||||||
|
>::type
|
||||||
|
find_if_s(Sequence& seq)
|
||||||
|
{
|
||||||
|
return detail::static_find_if_s<Sequence, Pred>::call(seq);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Pred, typename Sequence>
|
||||||
|
typename result_of::find_if_s<Sequence const, Pred>::type
|
||||||
|
find_if_s(Sequence const& seq)
|
||||||
|
{
|
||||||
|
return detail::static_find_if_s<Sequence const, Pred>::call(seq);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
75
include/boost/fusion/algorithm/query/find.hpp
Normal file
75
include/boost/fusion/algorithm/query/find.hpp
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_FIND_05052005_1107)
|
||||||
|
#define FUSION_FIND_05052005_1107
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/query/detail/assoc_find.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/support/category_of.hpp>
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct associative_sequence_tag;
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <
|
||||||
|
typename Sequence
|
||||||
|
, typename T
|
||||||
|
, bool is_associative_sequence = traits::is_associative<Sequence>::value >
|
||||||
|
struct find;
|
||||||
|
|
||||||
|
template <typename Sequence, typename T>
|
||||||
|
struct find<Sequence, T, false>
|
||||||
|
{
|
||||||
|
typedef
|
||||||
|
detail::static_seq_find_if<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type
|
||||||
|
, is_same<mpl::_, T>
|
||||||
|
>
|
||||||
|
filter;
|
||||||
|
|
||||||
|
typedef typename filter::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Sequence, typename T>
|
||||||
|
struct find<Sequence, T, true>
|
||||||
|
{
|
||||||
|
typedef detail::assoc_find<Sequence, T> filter;
|
||||||
|
typedef typename filter::type type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename Sequence>
|
||||||
|
inline typename
|
||||||
|
lazy_disable_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, result_of::find<Sequence, T>
|
||||||
|
>::type const
|
||||||
|
find(Sequence& seq)
|
||||||
|
{
|
||||||
|
typedef typename result_of::find<Sequence, T>::filter filter;
|
||||||
|
return filter::call(seq);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename Sequence>
|
||||||
|
inline typename result_of::find<Sequence const, T>::type const
|
||||||
|
find(Sequence const& seq)
|
||||||
|
{
|
||||||
|
typedef typename result_of::find<Sequence const, T>::filter filter;
|
||||||
|
return filter::call(seq);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
69
include/boost/fusion/algorithm/query/find_if.hpp
Normal file
69
include/boost/fusion/algorithm/query/find_if.hpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_FIND_IF_05052005_1108)
|
||||||
|
#define FUSION_FIND_IF_05052005_1108
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Pred>
|
||||||
|
struct find_if
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
detail::static_find_if<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type
|
||||||
|
, Pred
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Pred, typename Sequence>
|
||||||
|
inline typename
|
||||||
|
lazy_disable_if<
|
||||||
|
is_const<Sequence>
|
||||||
|
, result_of::find_if<Sequence, Pred>
|
||||||
|
>::type
|
||||||
|
find_if(Sequence& seq)
|
||||||
|
{
|
||||||
|
typedef
|
||||||
|
detail::static_find_if<
|
||||||
|
typename result_of::begin<Sequence>::type
|
||||||
|
, typename result_of::end<Sequence>::type
|
||||||
|
, Pred
|
||||||
|
>
|
||||||
|
filter;
|
||||||
|
|
||||||
|
return filter::call(fusion::begin(seq));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Pred, typename Sequence>
|
||||||
|
inline typename result_of::find_if<Sequence const, Pred>::type const
|
||||||
|
find_if(Sequence const& seq)
|
||||||
|
{
|
||||||
|
typedef
|
||||||
|
detail::static_find_if<
|
||||||
|
typename result_of::begin<Sequence const>::type
|
||||||
|
, typename result_of::end<Sequence const>::type
|
||||||
|
, Pred
|
||||||
|
>
|
||||||
|
filter;
|
||||||
|
|
||||||
|
return filter::call(fusion::begin(seq));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
33
include/boost/fusion/algorithm/query/none.hpp
Normal file
33
include/boost/fusion/algorithm/query/none.hpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
Copyright (c) 2007 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_NONE_07062005_1128)
|
||||||
|
#define BOOST_FUSION_NONE_07062005_1128
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/any.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
struct none
|
||||||
|
{
|
||||||
|
typedef bool type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename F>
|
||||||
|
inline bool
|
||||||
|
none(Sequence const& seq, F f)
|
||||||
|
{
|
||||||
|
return !fusion::any(seq, f);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
28
include/boost/fusion/algorithm/transformation.hpp
Normal file
28
include/boost/fusion/algorithm/transformation.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ALGORITHM_TRANSFORMATION_10022005_0551)
|
||||||
|
#define FUSION_ALGORITHM_TRANSFORMATION_10022005_0551
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/transformation/clear.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/erase.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/erase_key.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/filter.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/filter_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/insert.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/insert_range.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/pop_front.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/push_back.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/push_front.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/remove.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/remove_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/replace.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/replace_if.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/reverse.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||||
|
|
||||||
|
#endif
|
32
include/boost/fusion/algorithm/transformation/clear.hpp
Normal file
32
include/boost/fusion/algorithm/transformation/clear.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_CLEAR_09172005_1127)
|
||||||
|
#define FUSION_CLEAR_09172005_1127
|
||||||
|
|
||||||
|
#include <boost/fusion/container/vector/vector10.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct clear
|
||||||
|
{
|
||||||
|
typedef vector0 type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence>
|
||||||
|
inline typename result_of::clear<Sequence const>::type
|
||||||
|
clear(Sequence const& seq)
|
||||||
|
{
|
||||||
|
return vector0();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_REPLACE_08182005_0841)
|
||||||
|
#define FUSION_REPLACE_08182005_0841
|
||||||
|
|
||||||
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/type_traits/remove_reference.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <bool is_convertible>
|
||||||
|
struct replacer_helper;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct replacer_helper<false>
|
||||||
|
{
|
||||||
|
template <typename U, typename T>
|
||||||
|
static U&
|
||||||
|
call(U& x, T const&, T const&)
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct replacer_helper<true>
|
||||||
|
{
|
||||||
|
template <typename U, typename T>
|
||||||
|
static U
|
||||||
|
call(U& x, T const& old_value, T const& new_value)
|
||||||
|
{
|
||||||
|
return (x == old_value) ? new_value : x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct replacer
|
||||||
|
{
|
||||||
|
replacer(T const& old_value, T const& new_value)
|
||||||
|
: old_value(old_value), new_value(new_value) {}
|
||||||
|
|
||||||
|
template<typename Sig>
|
||||||
|
struct result;
|
||||||
|
|
||||||
|
template <typename U1, typename U2>
|
||||||
|
struct result<replacer<U1>(U2)>
|
||||||
|
{
|
||||||
|
typedef typename remove_reference<U2>::type value;
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<is_convertible<T, value>, value, value const&>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename U>
|
||||||
|
typename result<replacer(U)>::type
|
||||||
|
operator()(U const& x) const
|
||||||
|
{
|
||||||
|
return replacer_helper<is_convertible<T, U>::value>::
|
||||||
|
call(x, old_value, new_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
T old_value;
|
||||||
|
T new_value;
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_REPLACE_IF_08182005_0946)
|
||||||
|
#define FUSION_REPLACE_IF_08182005_0946
|
||||||
|
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/type_traits/remove_reference.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <bool is_convertible>
|
||||||
|
struct replacer_if_helper;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct replacer_if_helper<false>
|
||||||
|
{
|
||||||
|
template <typename U, typename F, typename T>
|
||||||
|
static U&
|
||||||
|
call(U& x, F&, T const&)
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct replacer_if_helper<true>
|
||||||
|
{
|
||||||
|
template <typename U, typename F, typename T>
|
||||||
|
static U
|
||||||
|
call(U& x, F& f, T const& new_value)
|
||||||
|
{
|
||||||
|
return f(x) ? new_value : x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename F, typename T>
|
||||||
|
struct replacer_if
|
||||||
|
{
|
||||||
|
replacer_if(F f, T const& new_value)
|
||||||
|
: f(f), new_value(new_value) {}
|
||||||
|
|
||||||
|
template<typename Params>
|
||||||
|
struct result;
|
||||||
|
|
||||||
|
template <typename F1, typename T1, typename U>
|
||||||
|
struct result<replacer_if<F1, T1>(U)>
|
||||||
|
{
|
||||||
|
typedef typename remove_reference<U>::type value;
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<is_convertible<T, value>, value, value const&>::type
|
||||||
|
type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename U>
|
||||||
|
typename result<replacer_if(U)>::type
|
||||||
|
operator()(U const& x) const
|
||||||
|
{
|
||||||
|
return replacer_if_helper<is_convertible<T, U>::value>::
|
||||||
|
call(x, f, new_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
F f;
|
||||||
|
T new_value;
|
||||||
|
};
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
108
include/boost/fusion/algorithm/transformation/erase.hpp
Normal file
108
include/boost/fusion/algorithm/transformation/erase.hpp
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ERASE_07232005_0534)
|
||||||
|
#define FUSION_ERASE_07232005_0534
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/equal_to.hpp>
|
||||||
|
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||||
|
#include <boost/fusion/container/vector/vector10.hpp>
|
||||||
|
#include <boost/fusion/view/joint_view/joint_view.hpp>
|
||||||
|
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
|
||||||
|
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename First>
|
||||||
|
struct compute_erase_last // put this in detail!!!
|
||||||
|
{
|
||||||
|
typedef typename result_of::end<Sequence>::type seq_last_type;
|
||||||
|
typedef typename convert_iterator<First>::type first_type;
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
result_of::equal_to<first_type, seq_last_type>
|
||||||
|
, first_type
|
||||||
|
, typename result_of::next<first_type>::type
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(First const& first, mpl::false_)
|
||||||
|
{
|
||||||
|
return fusion::next(convert_iterator<First>::call(first));
|
||||||
|
}
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(First const& first, mpl::true_)
|
||||||
|
{
|
||||||
|
return convert_iterator<First>::call(first);
|
||||||
|
}
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(First const& first)
|
||||||
|
{
|
||||||
|
return call(first, result_of::equal_to<first_type, seq_last_type>());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename Sequence
|
||||||
|
, typename First
|
||||||
|
, typename Last = typename compute_erase_last<Sequence, First>::type>
|
||||||
|
struct erase
|
||||||
|
{
|
||||||
|
typedef typename result_of::begin<Sequence>::type seq_first_type;
|
||||||
|
typedef typename result_of::end<Sequence>::type seq_last_type;
|
||||||
|
BOOST_STATIC_ASSERT((!result_of::equal_to<seq_first_type, seq_last_type>::value));
|
||||||
|
|
||||||
|
typedef typename convert_iterator<First>::type first_type;
|
||||||
|
typedef typename convert_iterator<Last>::type last_type;
|
||||||
|
typedef iterator_range<seq_first_type, first_type> left_type;
|
||||||
|
typedef iterator_range<last_type, seq_last_type> right_type;
|
||||||
|
typedef joint_view<left_type, right_type> type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename First>
|
||||||
|
typename result_of::erase<Sequence const, First>::type
|
||||||
|
erase(Sequence const& seq, First const& first)
|
||||||
|
{
|
||||||
|
typedef result_of::erase<Sequence const, First> result_of;
|
||||||
|
typedef typename result_of::left_type left_type;
|
||||||
|
typedef typename result_of::right_type right_type;
|
||||||
|
typedef typename result_of::type result_type;
|
||||||
|
|
||||||
|
left_type left(
|
||||||
|
fusion::begin(seq)
|
||||||
|
, convert_iterator<First>::call(first));
|
||||||
|
right_type right(
|
||||||
|
fusion::result_of::compute_erase_last<Sequence const, First>::call(first)
|
||||||
|
, fusion::end(seq));
|
||||||
|
return result_type(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Sequence, typename First, typename Last>
|
||||||
|
typename result_of::erase<Sequence const, First, Last>::type
|
||||||
|
erase(Sequence const& seq, First const& first, Last const& last)
|
||||||
|
{
|
||||||
|
typedef result_of::erase<Sequence const, First, Last> result_of;
|
||||||
|
typedef typename result_of::left_type left_type;
|
||||||
|
typedef typename result_of::right_type right_type;
|
||||||
|
typedef typename result_of::type result_type;
|
||||||
|
|
||||||
|
left_type left(fusion::begin(seq), first);
|
||||||
|
right_type right(last, fusion::end(seq));
|
||||||
|
return result_type(left, right);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
37
include/boost/fusion/algorithm/transformation/erase_key.hpp
Normal file
37
include/boost/fusion/algorithm/transformation/erase_key.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2006 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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(FUSION_ERASE_KEY_10022005_1851)
|
||||||
|
#define FUSION_ERASE_KEY_10022005_1851
|
||||||
|
|
||||||
|
#include <boost/fusion/algorithm/query/detail/assoc_find.hpp>
|
||||||
|
#include <boost/fusion/algorithm/transformation/erase.hpp>
|
||||||
|
#include <boost/mpl/not.hpp>
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename Key>
|
||||||
|
struct erase_key
|
||||||
|
{
|
||||||
|
typedef detail::assoc_find<Sequence, Key> filter;
|
||||||
|
typedef typename erase<Sequence, typename filter::type>::type type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Key, typename Sequence>
|
||||||
|
inline typename result_of::erase_key<Sequence const, Key>::type
|
||||||
|
erase_key(Sequence const& seq)
|
||||||
|
{
|
||||||
|
typedef typename result_of::erase_key<Sequence const, Key>::filter filter;
|
||||||
|
return erase(seq, filter::call(seq));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user