Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59241 - sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view
From: erwann.rogard_at_[hidden]
Date: 2010-01-23 15:01:18


Author: e_r
Date: 2010-01-23 15:01:17 EST (Sat, 23 Jan 2010)
New Revision: 59241
URL: http://svn.boost.org/trac/boost/changeset/59241

Log:
m
Added:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/bind_iterator.hpp
      - copied, changed from r59233, /sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp
Removed:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp
Text files modified:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/bind_iterator.hpp | 65 +++++++++++++++++++++++++++++++++++----
   1 files changed, 58 insertions(+), 7 deletions(-)

Copied: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/bind_iterator.hpp (from r59233, /sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp)
==============================================================================
--- /sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp (original)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/bind_iterator.hpp 2010-01-23 15:01:17 EST (Sat, 23 Jan 2010)
@@ -20,6 +20,7 @@
 namespace fusion{
 namespace joint_view{
 namespace result_of{
+namespace impl{
 
         // e.g Binder = joint_view::binder<>
         template<typename Binder,typename It>
@@ -28,25 +29,75 @@
         typedef typename iterator_value<It>::type seq2_;
         typedef typename boost::add_const<seq2_>::type c_;
         typedef typename boost::add_reference<c_>::type cref_;
- typedef typename boost::result_of<binder_(cref_)>::type res_;
+ typedef typename boost::result_of<Binder(cref_)>::type res_;
         typedef boost::function<res_(cref_)> fun_;
         typedef boost::transform_iterator<fun_,It> type;
- static type call(const binder_& binder,It it)
+
+ static type call(const Binder& binder,It it)
         {
             return type(it,binder);
         }
     };
-
 }
+ // transforms *it to join_view(seq1,(*it))
+ template<typename Seq1,typename It, bool is_left = true>
+ struct bind_iterator
+ {
+ typedef detail::fusion::joint_view::binder<Seq1,is_left> binder_;
+ typedef detail::fusion::joint_view::result_of::impl::bind_iterator<
+ binder_,It
+ > meta_;
+ typedef typename meta_::type type;
+ static type call(const Seq1& seq1,It it)
+ {
+ return meta_(binder_(seq1),it);
+ }
+ };
+
+ template<typename Seq1,typename R,bool is_left = true>
+ struct bind_range
+ {
+
+ typedef typename boost::range_iterator<R>::type it_;
+ typedef detail::fusion::joint_view::result_of::bind_iterator<
+ Seq1,it_
+ > impl_;
+ typedef typename impl_::type type;
+
+ static type call(const Seq1& seq1,R r)
+ {
+ return type(
+ impl_::call(seq1,boost::begin(r)),
+ impl_::call(seq1,boost::end(r))
+ );
+ }
+ };
+
+
+}// result_of
 
- template<typename Binder,typename It>
- typename detail::joint_view::result_of::bind_iterator<Binder,It>::type
- bind_iterator(const Binder& binder,It it)
+ template<typename Seq1,typename It>
+ typename detail::fusion::joint_view::result_of::bind_iterator<Seq1,It>::type
+ bind_iterator(const Seq1& seq1,It it)
     {
- typedef detail::joint_view::result_of::bind_iterator<Binder,It> meta_;
+ typedef detail::fusion::joint_view::result_of::bind_iterator<
+ Seq1,
+ It
+ > meta_;
             return meta_::call(binder,it);
     }
     
+ template<typename Seq1,typename It>
+ typename detail::fusion::joint_view::result_of::bind_range<Seq1,It>::type
+ bind_range(const Seq1& seq1,It it)
+ {
+ typedef detail::fusion::joint_view::result_of::bind_range<
+ Seq1,
+ It
+ > meta_;
+ return meta_::call(binder,it);
+ }
+
 }// joint_view
 }// fusion
 }// detail

Deleted: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp
==============================================================================
--- sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp 2010-01-23 15:01:17 EST (Sat, 23 Jan 2010)
+++ (empty file)
@@ -1,56 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// statistics::detail::fusion::joint_view::bind_iterator.hpp //
-// //
-// Copyright 2009 Erwann Rogard. 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) //
-///////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_STATISTICS_DETAIL_FUSION_JOINT_VIEW_BINDER_ITERATOR_HPP_ER_2009
-#define BOOST_STATISTICS_DETAIL_FUSION_JOINT_VIEW_BINDER_ITERATOR_HPP_ER_2009
-#include <boost/utility/result_of.hpp>
-#include <boost/range.hpp>
-#include <boost/type_traits/add_const.hpp>
-#include <boost/type_traits/add_reference.hpp>
-#include <boost/iterator/iterator_traits.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-
-namespace boost{
-namespace statistics{
-namespace detail{
-namespace fusion{
-namespace joint_view{
-namespace result_of{
-
- // e.g Binder = joint_view::binder<>
- template<typename Binder,typename It>
- struct bind_iterator
- {
- typedef typename iterator_value<It>::type seq2_;
- typedef typename boost::add_const<seq2_>::type c_;
- typedef typename boost::add_reference<c_>::type cref_;
- typedef typename boost::result_of<binder_(cref_)>::type res_;
- typedef boost::function<res_(cref_)> fun_;
- typedef boost::transform_iterator<fun_,It> type;
- static type call(const binder_& binder,It it)
- {
- return type(it,binder);
- }
- };
-
-}
-
- template<typename Binder,typename It>
- typename detail::joint_view::result_of::bind_iterator<Binder,It>::type
- bind_iterator(const Binder& binder,It it)
- {
- typedef detail::joint_view::result_of::bind_iterator<Binder,It> meta_;
- return meta_::call(binder,it);
- }
-
-}// joint_view
-}// fusion
-}// detail
-}// statistics
-}// boost
-
-#endif
\ No newline at end of file


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