merge from trunk

[SVN r42225]
This commit is contained in:
Joel de Guzman
2007-12-21 02:45:20 +00:00
parent d57e8cfe9e
commit 7bd2fd716d
19 changed files with 45 additions and 438 deletions

View File

@ -2,7 +2,7 @@
Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#if !defined(BOOST_FUSION_ADAPTED_30122005_1420) #if !defined(BOOST_FUSION_ADAPTED_30122005_1420)
@ -12,6 +12,6 @@
#include <boost/fusion/adapted/std_pair.hpp> #include <boost/fusion/adapted/std_pair.hpp>
#include <boost/fusion/adapted/array.hpp> #include <boost/fusion/adapted/array.hpp>
#include <boost/fusion/adapted/mpl.hpp> #include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/adapted/variant.hpp> #include <boost/fusion/adapted/struct.hpp>
#endif #endif

View File

@ -10,14 +10,19 @@
#include <boost/fusion/adapted/struct/extension.hpp> #include <boost/fusion/adapted/struct/extension.hpp>
#include <boost/fusion/adapted/struct/adapt_struct.hpp> #include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
#include <boost/fusion/adapted/struct/struct_iterator.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/at_impl.hpp>
#include <boost/fusion/adapted/struct/detail/at_key_impl.hpp>
#include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/struct/detail/end_impl.hpp>
#include <boost/fusion/adapted/struct/detail/has_key_impl.hpp>
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp> #include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/struct/detail/value_at_key_impl.hpp>
#endif #endif

View File

@ -53,7 +53,7 @@ namespace boost { namespace fusion { namespace extension {
// SEQ_FOR_EACH_I to generate the "linear" substructures. // SEQ_FOR_EACH_I to generate the "linear" substructures.
// Thanks to Paul Mensonides for the PP macro help // Thanks to Paul Mensonides for the PP macro help
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_I(name, seq) \ #define BOOST_FUSION_ADAPT_ASSOC_STRUCT_I(name, seq) \
namespace boost { namespace fusion { namespace traits \ namespace boost { namespace fusion { namespace traits \
{ \ { \
template <> \ template <> \
@ -66,11 +66,11 @@ namespace boost { namespace fusion { namespace extension {
{ \ { \
template <> \ template <> \
struct struct_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \ 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) \ 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) \ #define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C(r, name, i, xy) \
template <> \ template <> \
struct struct_member<name, i> \ struct struct_member<name, i> \
{ \ { \

View File

@ -19,13 +19,21 @@ namespace boost { namespace fusion
template <typename Tag> template <typename Tag>
struct end_impl; struct end_impl;
template <typename Struct>
struct struct_size;
template <> template <>
struct end_impl<struct_tag> struct end_impl<struct_tag>
{ {
template <typename Sequence> template <typename Sequence>
struct apply struct apply
{ {
typedef struct_iterator<Sequence, 2> type; typedef
struct_iterator<
Sequence
, struct_size<Sequence>::value
>
type;
static type static type
call(Sequence& v) call(Sequence& v)

View File

@ -50,7 +50,7 @@ namespace boost { namespace fusion { namespace extension
struct struct_assoc_member<Struct const, Key> struct struct_assoc_member<Struct const, Key>
{ {
typedef typename typedef typename
add_const<typename struct_assoc_member<Struct, Key>::type>::type add_const<typename struct_assoc_member<Struct, Key>::type>::type
type; type;
static type& static type&

View File

@ -1,20 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

View File

@ -1,45 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,33 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,45 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,31 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,31 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,32 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

@ -1,32 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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)>
#if defined(BOOST_PARTIAL_SPECIALIZATION_EXPLICT_ARGS)
struct tag_of<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, void >
#else
struct tag_of<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
#endif
{
typedef variant_tag type;
};
}
}}
#endif

View File

@ -1,117 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_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

View File

@ -7,6 +7,6 @@
#if !defined(FUSION_INCLUDE_ACCUMULATE) #if !defined(FUSION_INCLUDE_ACCUMULATE)
#define FUSION_INCLUDE_ACCUMULATE #define FUSION_INCLUDE_ACCUMULATE
#include <boost/fusion/algorithm/accumulate.hpp> #include <boost/fusion/algorithm/iteration/accumulate.hpp>
#endif #endif

View File

@ -1,12 +0,0 @@
/*=============================================================================
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(FUSION_INCLUDE_UTILITY)
#define FUSION_INCLUDE_UTILITY
#include <boost/fusion/sequence/utility.hpp>
#endif

View File

@ -1,12 +0,0 @@
/*=============================================================================
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(FUSION_INCLUDE_VARIANT)
#define FUSION_INCLUDE_VARIANT
#include <boost/fusion/adapted/variant.hpp>
#endif

View File

@ -1,14 +0,0 @@
//
// Copyright (c) 2006 João Abecasis
//
// 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_SEQUENCE_UTILITY_HPP_INCLUDED)
#define BOOST_FUSION_SEQUENCE_UTILITY_HPP_INCLUDED
# include <boost/fusion/sequence/utility/unpack_args.hpp>
#endif // include guard

View File

@ -25,6 +25,24 @@ namespace boost { namespace fusion { namespace traits
typedef T type; typedef T type;
}; };
template <typename T>
struct deduce<T const>
{
typedef T type;
};
template <typename T>
struct deduce<T volatile>
{
typedef T type;
};
template <typename T>
struct deduce<T const volatile>
{
typedef T type;
};
// Keep references on mutable LValues // Keep references on mutable LValues
template <typename T> template <typename T>