diff --git a/include/boost/fusion/sequence/adapted.hpp b/include/boost/fusion/sequence/adapted.hpp index b9f6ca3c..80b05e21 100644 --- a/include/boost/fusion/sequence/adapted.hpp +++ b/include/boost/fusion/sequence/adapted.hpp @@ -13,5 +13,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/sequence/adapted/variant.hpp b/include/boost/fusion/sequence/adapted/variant.hpp new file mode 100644 index 00000000..ce2f2ebb --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_12112006_1614) +#define BOOST_FUSION_VARIANT_12112006_1614 + +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted/variant/detail/begin_impl.hpp b/include/boost/fusion/sequence/adapted/variant/detail/begin_impl.hpp new file mode 100644 index 00000000..fdf53755 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant/detail/begin_impl.hpp @@ -0,0 +1,46 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_BEGIN_IMPL_12112006_2137) +#define BOOST_FUSION_VARIANT_BEGIN_IMPL_12112006_2137 + +#include + +namespace boost { namespace fusion { + + struct variant_tag; + + template + struct variant_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef variant_iterator< + Seq, + typename mpl::begin::type> type; + + static type + call(Seq& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/variant/detail/end_impl.hpp b/include/boost/fusion/sequence/adapted/variant/detail/end_impl.hpp new file mode 100644 index 00000000..0414e7a9 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant/detail/end_impl.hpp @@ -0,0 +1,46 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_END_IMPL_12112006_2137) +#define BOOST_FUSION_VARIANT_END_IMPL_12112006_2137 + +#include + +namespace boost { namespace fusion { + + struct variant_tag; + + template + struct variant_iterator; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef variant_iterator< + Seq, + typename mpl::end::type> type; + + static type + call(Seq& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/variant/detail/size_impl.hpp b/include/boost/fusion/sequence/adapted/variant/detail/size_impl.hpp new file mode 100644 index 00000000..eb05f812 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant/detail/size_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_SIZE_IMPL_12112006_2115) +#define BOOST_FUSION_VARIANT_SIZE_IMPL_12112006_2115 + +#include + +namespace boost { namespace fusion { + + struct variant_tag; + + namespace extension + { + template + struct size_impl; + + template<> + struct size_impl + { + template + struct apply : mpl::size + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/variant/tag_of.hpp b/include/boost/fusion/sequence/adapted/variant/tag_of.hpp new file mode 100644 index 00000000..cd9dc2fc --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant/tag_of.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_TAG_OF_12112006_1704) +#define BOOST_FUSION_VARIANT_TAG_OF_12112006_1704 + +#include +#include + +namespace boost { namespace fusion +{ + struct variant_tag; + + namespace traits + { + template + struct tag_of > + { + typedef variant_tag type; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/variant/variant_iterator.hpp b/include/boost/fusion/sequence/adapted/variant/variant_iterator.hpp new file mode 100644 index 00000000..edf3c096 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/variant/variant_iterator.hpp @@ -0,0 +1,94 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VARIANT_ITERATOR_12112006_1617) +#define BOOST_FUSION_VARIANT_ITERATOR_12112006_1617 + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct forward_traversal_tag; + + template + struct variant_iterator + : iterator_facade, forward_traversal_tag> + { + typedef Variant variant_type; + typedef Iterator iterator; + + variant_iterator(Variant& var) + : var_(var) {} + Variant& var_; + + template + struct next + { + typedef variant_iterator< + typename Iterator::variant_type, + typename mpl::next::type> type; + + static type + call(Iterator const& i) + { + return type(i.var_); + } + }; + + template + 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 + struct value_of + : mpl::deref + {}; + + template + struct deref + { + typedef typename mpl::eval_if< + is_const, + typename add_const::type>, + typename mpl::deref + >::type + type; + + static type + call(Iterator const & it) + { + typedef typename mpl::deref::type type; + type* result = get(&it.var_); + return result ? *result : type(); + } + }; + }; + +}} + +#endif