diff --git a/include/boost/fusion/adapted.hpp b/include/boost/fusion/adapted.hpp index 29ed515b..bcff7161 100644 --- a/include/boost/fusion/adapted.hpp +++ b/include/boost/fusion/adapted.hpp @@ -16,4 +16,10 @@ #include #include +// The std_tuple_iterator adaptor only supports implementations +// using variadic templates +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#include +#endif + #endif diff --git a/include/boost/fusion/adapted/std_tuple.hpp b/include/boost/fusion/adapted/std_tuple.hpp new file mode 100644 index 00000000..a49b4807 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple.hpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_BOOST_TUPLE_09242011_1744) +#define BOOST_FUSION_BOOST_TUPLE_09242011_1744 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp new file mode 100644 index 00000000..2f09719c --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_AT_IMPL_09242011_1744) +#define BOOST_FUSION_AT_IMPL_09242011_1744 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + typedef typename remove_const::type seq_type; + typedef std::tuple_element element; + + typedef typename + mpl::eval_if< + is_const + , fusion::detail::cref_result + , fusion::detail::ref_result + >::type + type; + + static type + call(Sequence& seq) + { + return std::get(seq); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/begin_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/begin_impl.hpp new file mode 100644 index 00000000..8b219024 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/begin_impl.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_BEGIN_IMPL_09242011_1744) +#define BOOST_FUSION_BEGIN_IMPL_09242011_1744 + +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef std_tuple_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/category_of_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/category_of_impl.hpp new file mode 100644 index 00000000..96d567d5 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/category_of_impl.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_09272006_0726) +#define BOOST_FUSION_CATEGORY_OF_IMPL_09272006_0726 + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/end_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/end_impl.hpp new file mode 100644 index 00000000..78782b79 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/end_impl.hpp @@ -0,0 +1,43 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_END_IMPL_09242011_1744) +#define BOOST_FUSION_END_IMPL_09242011_1744 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename remove_const::type seq_type; + static int const size = std::tuple_size::value; + typedef std_tuple_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/is_sequence_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/is_sequence_impl.hpp new file mode 100644 index 00000000..6da5bdc3 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/is_sequence_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_09242011_1744) +#define BOOST_FUSION_IS_SEQUENCE_IMPL_09242011_1744 + +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/is_view_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/is_view_impl.hpp new file mode 100644 index 00000000..9439431b --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/is_view_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_IS_VIEW_IMPL_09242011_1744) +#define BOOST_FUSION_IS_VIEW_IMPL_09242011_1744 + +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::false_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/size_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/size_impl.hpp new file mode 100644 index 00000000..30595dec --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/size_impl.hpp @@ -0,0 +1,31 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_SIZE_IMPL_09242011_1744) +#define BOOST_FUSION_SIZE_IMPL_09242011_1744 + +#include +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : mpl::int_::value> {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/value_at_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/value_at_impl.hpp new file mode 100644 index 00000000..fa9656e7 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/value_at_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VALUE_AT_IMPL_09242011_1744) +#define BOOST_FUSION_VALUE_AT_IMPL_09242011_1744 + +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply : std::tuple_element {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp new file mode 100644 index 00000000..4998e21d --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp @@ -0,0 +1,107 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_STD_TUPLE_ITERATOR_09112011_1905) +#define FUSION_STD_TUPLE_ITERATOR_09112011_1905 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct random_access_traversal_tag; + + template + struct std_tuple_iterator_identity; + + template + struct std_tuple_iterator + : iterator_facade< + std_tuple_iterator + , random_access_traversal_tag> + { + typedef Tuple tuple_type; + static int const index = Index; + typedef std_tuple_iterator_identity< + typename add_const::type, Index> + identity; + + explicit std_tuple_iterator(Tuple& tuple) + : tuple(tuple) {} + + Tuple& tuple; + + template + struct value_of + : std::tuple_element::type> {}; + + template + struct deref + { + typedef value_of element; + typedef typename + mpl::eval_if< + is_const + , fusion::detail::cref_result + , fusion::detail::ref_result + >::type + type; + + static type + call(Iterator const& iter) + { + return std::get(iter.tuple); + } + }; + + template + struct advance + { + static int const index = Iterator::index; + typedef typename Iterator::tuple_type tuple_type; + typedef std_tuple_iterator type; + + static type + call(Iterator const& i) + { + return type(i.tuple); + } + }; + + template + struct next : advance> {}; + + template + struct prior : advance> {}; + + template + struct equal_to + : is_same {}; + + template + struct distance + { + typedef mpl::int_ type; + + static type + call(First const&, Last const&) + { + return type(); + } + }; + }; +}} + +#endif + + diff --git a/include/boost/fusion/adapted/std_tuple/tag_of.hpp b/include/boost/fusion/adapted/std_tuple/tag_of.hpp new file mode 100644 index 00000000..6db1c486 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/tag_of.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_TAG_OF_09112011_1842) +#define BOOST_FUSION_TAG_OF_09112011_1842 + +#include +#include + +namespace std +{ + template + class tuple; +} + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + struct fusion_sequence_tag; + + namespace traits + { + template + struct tag_of> + { + typedef std_tuple_tag type; + }; + } +}} + +namespace boost { namespace mpl +{ + template + struct sequence_tag; + + template + struct sequence_tag> + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag const> + { + typedef fusion::fusion_sequence_tag type; + }; +}} + +#endif diff --git a/include/boost/fusion/iterator/advance.hpp b/include/boost/fusion/iterator/advance.hpp index edc72305..bfd8af4b 100644 --- a/include/boost/fusion/iterator/advance.hpp +++ b/include/boost/fusion/iterator/advance.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_ADVANCE_09172005_1146) @@ -18,7 +18,7 @@ namespace boost { namespace fusion { struct random_access_traversal_tag; - + // Special tags: struct iterator_facade_tag; // iterator facade tag struct boost_array_iterator_tag; // boost::array iterator tag @@ -59,7 +59,7 @@ namespace boost { namespace fusion template <> struct advance_impl; } - + namespace result_of { template