Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57261 - in sandbox/SOC/2009/fusion/boost/fusion: adapted/detail/array adapted/detail/tuple algorithm/iteration/ext_ algorithm/query/ext_ container/generation container/list sequence/intrinsic/ext_ support/ext_
From: mr.chr.schmidt_at_[hidden]
Date: 2009-10-31 17:37:22


Author: cschmidt
Date: 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
New Revision: 57261
URL: http://svn.boost.org/trac/boost/changeset/57261

Log:
proto compatibility
Added:
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/ext_/
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/ext_/
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/ext_/find_if_s.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/
   sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/size_s.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/support/ext_/
   sandbox/SOC/2009/fusion/boost/fusion/support/ext_/is_segmented.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp | 1 +
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp | 1 +
   sandbox/SOC/2009/fusion/boost/fusion/container/generation/make_cons.hpp | 5 +++--
   sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp | 6 +++---
   4 files changed, 8 insertions(+), 5 deletions(-)

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -9,6 +9,7 @@
 
 #include <boost/config.hpp>
 #include <boost/fusion/support/tag_of_fwd.hpp>
+#include <boost/fusion/support/category_of.hpp>
 
 #include <cstddef>
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -8,6 +8,7 @@
 
 #include <boost/config.hpp>
 #include <boost/fusion/support/tag_of_fwd.hpp>
+#include <boost/fusion/support/category_of.hpp>
 
 #ifdef BOOST_FUSION_ADAPTED_STD_TUPLE
 # ifdef BOOST_NO_0X_HDR_TUPLE

Added: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -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

Added: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/ext_/find_if_s.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/ext_/find_if_s.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -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

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/generation/make_cons.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/generation/make_cons.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/generation/make_cons.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -22,8 +22,9 @@
         struct make_cons
         {
             typedef
- cons<typename traits::deduce<Car>::type
- , typename traits::deduce<Cdr>::type
+ cons<
+ typename traits::deduce<Car>::type
+ , typename traits::deduce<Cdr>::type
>
             type;
         };

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -178,10 +178,10 @@
           , cdr(cdr_args)
         {}
 # else
- template<typename... CdrArgs>
+ template<typename OtherCar,typename... CdrArgs>
         explicit
- cons(Car&& car,CdrArgs&&... cdr_args)
- : car(std::forward<Car>(car))
+ cons(OtherCar&& other_car,CdrArgs&&... cdr_args)
+ : car(std::forward<OtherCar>(other_car))
           , cdr(std::forward<CdrArgs>(cdr_args)...)
         {}
 # endif

Added: sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -0,0 +1,56 @@
+/*=============================================================================
+ 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_SEGMENTS_04052005_1141)
+#define FUSION_SEGMENTS_04052005_1141
+
+#include <boost/fusion/support/tag_of.hpp>
+
+namespace boost { namespace fusion
+{
+ // segments: returns a sequence of sequences
+ namespace extension
+ {
+ template <typename Tag>
+ struct segments_impl
+ {
+ template <typename Sequence>
+ struct apply {};
+ };
+ }
+
+ namespace result_of
+ {
+ template <typename Sequence>
+ struct segments
+ {
+ typedef typename
+ extension::segments_impl<typename traits::tag_of<Sequence>::type>::
+ template apply<Sequence>::type
+ type;
+ };
+ }
+
+ template <typename Sequence>
+ typename result_of::segments<Sequence>::type
+ segments(Sequence & seq)
+ {
+ return
+ extension::segments_impl<typename traits::tag_of<Sequence>::type>::
+ template apply<Sequence>::call(seq);
+ }
+
+ template <typename Sequence>
+ typename result_of::segments<Sequence const>::type
+ segments(Sequence const& seq)
+ {
+ return
+ extension::segments_impl<typename traits::tag_of<Sequence>::type>::
+ template apply<Sequence const>::call(seq);
+ }
+}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/size_s.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/size_s.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -0,0 +1,57 @@
+/*=============================================================================
+ 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_SIZE_S_08112006_1141)
+#define FUSION_SIZE_S_08112006_1141
+
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/support/ext_/is_segmented.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
+
+namespace boost { namespace fusion
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // calculates the size of any segmented data structure.
+ template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
+ struct segmented_size;
+
+ namespace detail
+ {
+ struct size_plus
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename State, typename Seq>
+ struct result<This(State, Seq)>
+ : mpl::plus<
+ segmented_size<typename remove_reference<Seq>::type>
+ , typename remove_reference<State>::type
+ >
+ {};
+ };
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ template<typename Sequence, bool IsSegmented>
+ struct segmented_size
+ : result_of::fold<
+ typename result_of::segments<Sequence>::type
+ , mpl::size_t<0>
+ , detail::size_plus
+ >::type
+ {};
+
+ template<typename Sequence>
+ struct segmented_size<Sequence, false>
+ : result_of::size<Sequence>
+ {};
+}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/support/ext_/is_segmented.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/ext_/is_segmented.hpp 2009-10-31 17:37:21 EDT (Sat, 31 Oct 2009)
@@ -0,0 +1,48 @@
+/*=============================================================================
+ 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_IS_SEGMENTED_03202006_0015)
+#define FUSION_IS_SEGMENTED_03202006_0015
+
+#include <boost/fusion/support/tag_of.hpp>
+
+namespace boost { namespace fusion
+{
+ // Special tags:
+ struct sequence_facade_tag;
+ struct boost_tuple_tag; // boost::tuples::tuple tag
+ struct array_tag; // boost::array tag
+ struct mpl_sequence_tag; // mpl sequence tag
+ struct std_pair_tag; // std::pair tag
+ struct iterator_range_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct is_segmented_impl
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::false_
+ {};
+ };
+
+ template<>
+ struct is_segmented_impl<iterator_range_tag>;
+ }
+
+ namespace traits
+ {
+ template <typename Sequence>
+ struct is_segmented
+ : extension::is_segmented_impl<typename traits::tag_of<Sequence>::type>::
+ template apply<Sequence>
+ {
+ };
+ }
+}}
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk