creating branch for fusion 2.1

[SVN r40232]
This commit is contained in:
Joel de Guzman
2007-10-20 23:59:59 +00:00
parent c3fec7efe6
commit fc57a566cb
476 changed files with 25709 additions and 0 deletions

View 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

View File

@@ -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

View 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

View 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_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

View 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

View 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

View 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

View 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