|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66527 - sandbox/statistics/support/boost/assign/v2/chain/aux_
From: erwann.rogard_at_[hidden]
Date: 2010-11-12 10:30:47
Author: e_r
Date: 2010-11-12 10:30:44 EST (Fri, 12 Nov 2010)
New Revision: 66527
URL: http://svn.boost.org/trac/boost/changeset/66527
Log:
adding /boost/assign/v2/chain/aux_
Added:
sandbox/statistics/support/boost/assign/v2/chain/aux_/
sandbox/statistics/support/boost/assign/v2/chain/aux_/adaptor.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/chain/aux_/bitwise_or.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/chain/aux_/logical_and.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/chain/aux_/sub.hpp (contents, props changed)
Added: sandbox/statistics/support/boost/assign/v2/chain/aux_/adaptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/chain/aux_/adaptor.hpp 2010-11-12 10:30:44 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,65 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2009 Neil Groves //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_ADAPTOR_ER_2010_HPP
+#define BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_ADAPTOR_ER_2010_HPP
+#include <boost/mpl/void.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace chain_aux{
+
+ typedef boost::mpl::void_ void_;
+
+ // Tag1 controls conversion. Seet type_traits/meta_convert.hpp
+
+ template<typename U,typename Tag1 = use_default,typename Tag2 = void_>
+ struct adaptor1
+ {
+ adaptor1( U& r ) : value( r ){}
+ mutable U& value;
+ };
+
+ template<
+ typename Tag1 = use_default,
+ typename Tag2 = void_
+ >
+ struct adaptor2
+ {
+
+ adaptor2(){}
+
+ template<typename U>
+ struct result{
+ typedef chain_aux::adaptor1<U, Tag1, Tag2> type;
+ static type call(U& u){ return type( u ); }
+ };
+
+ template<typename R>
+ typename result<R>::type
+ operator()(R& r)const{
+ return result<R>::call ( r );
+ }
+
+ template<typename R>
+ typename result<R const>::type
+ operator()(R const& r)const{
+ return result<R const>::call( r );
+ }
+
+ };
+
+}// chain_aux
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/chain/aux_/bitwise_or.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/chain/aux_/bitwise_or.hpp 2010-11-12 10:30:44 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,82 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2009 Neil Groves //
+// Copyright (C) 2010 Manuel Peinado Gallego //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_BITWISE_OR_ER_2010_HPP
+#define BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_BITWISE_OR_ER_2010_HPP
+#include <boost/mpl/void.hpp>
+#include <boost/assign/v2/chain/traits/result.hpp>
+#include <boost/assign/v2/chain/aux_/adaptor.hpp>
+#include <boost/assign/v2/chain/aux_/sub.hpp>
+
+// Design:
+// - The original design is boost::chain in RangeEx
+// - ER modified as follows:
+// - sets the underlying iterator's Reference to one which both inputs are
+// convertible to.
+// - Constness is determined by that of the elements in each range, not that
+// of the range.
+// - Finally, MPG proposed a way to compose chains http://gist.github.com/287791
+// and a variant of it is used below.
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace adaptor{
+namespace{
+ const chain_aux::adaptor2<> _chain = chain_aux::adaptor2<>();
+}
+}// adaptor
+namespace result_of{
+
+ template<typename R1, typename R2, typename Tag = use_default>
+ struct chain : chain_aux::result<R1, R2, Tag>{};
+
+}// result_of
+namespace chain_aux{
+
+#define BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(U1) \
+ template<typename R1,typename U2,typename Tag> \
+ typename chain_aux::result<U1, U2, Tag>::type \
+ operator|(U1 & r1, chain_aux::adaptor1<U2, Tag> const & h) \
+ { \
+ typedef chain_aux::result<U1, U2, Tag> caller_; \
+ return chain_aux::make_sub( caller_::call( r1, h.value ) ); \
+ } \
+\
+/**/
+
+BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 )
+BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 const)
+#undef BOOST_ASSIGN_V2_FRAMEWORK_CHAIN
+
+}// chain_aux
+
+//#define BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(U1, U2) \
+// template<typename Tag,typename R1,typename R2> \
+// typename chain_aux::result<U1, U2, Tag>::type \
+// chain(U1 & r1, U2 & r2) \
+// { \
+// return r1 | adaptor::_chain( r2 ); \
+// } \
+//\
+///**/
+
+//BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 , R2 )
+//BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 , R2 const )
+//BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 const, R2 )
+//BOOST_ASSIGN_V2_FRAMEWORK_CHAIN(R1 const, R2 const )
+//#undef BOOST_ASSIGN_V2_FRAMEWORK_CHAIN
+
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/chain/aux_/logical_and.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/chain/aux_/logical_and.hpp 2010-11-12 10:30:44 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,44 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2009 Neil Groves //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_CHAIN_FUNCTION_LOGICAL_AND_ER_2010_HPP
+#define BOOST_ASSIGN_V2_CHAIN_FUNCTION_LOGICAL_AND_ER_2010_HPP
+#include <boost/assign/v2/chain/aux_/bitwise_or.hpp>
+#include <boost/assign/v2/chain/traits/result.hpp>
+
+// This is an alternative syntax for chaining
+
+namespace boost{
+namespace assign{
+namespace v2{
+
+#define BOOST_ASSIGN_V2_CHAIN_OPERATOR(U1, U2) \
+template<typename R1,typename R2> \
+typename chain_aux::result< \
+ U1, \
+ U2 \
+>::type \
+operator&&(U1& r1, U2 & r2) \
+{ \
+ return r1 | adaptor::_chain( r2 ); \
+} \
+/**/
+
+BOOST_ASSIGN_V2_CHAIN_OPERATOR( R1 , R2 )
+BOOST_ASSIGN_V2_CHAIN_OPERATOR( R1 , R2 const )
+BOOST_ASSIGN_V2_CHAIN_OPERATOR( R1 const, R2 )
+BOOST_ASSIGN_V2_CHAIN_OPERATOR( R1 const, R2 const )
+#undef BOOST_ASSIGN_V2_CHAIN_OPERATOR
+
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/chain/aux_/sub.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/chain/aux_/sub.hpp 2010-11-12 10:30:44 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,60 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2009 Neil Groves //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_SUB_ER_2010_HPP
+#define BOOST_ASSIGN_V2_RANGE_CHAIN_AUX_SUB_ER_2010_HPP
+#include <boost/range/iterator_range.hpp> //iterator_range_detail::
+#include <boost/assign/v2/put/range/convert.hpp>
+#include <boost/assign/v2/detail/relational_op/relational_op.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace chain_aux{
+
+ // Adds a conversion capability to a range
+ //
+ // TODO : for now relational_op is disabled as conflicts with
+ // iterator_range's implem.
+ template<typename R>
+ struct sub : R //, relational_op_aux::crtp< sub<R> >
+ {
+
+ typedef R super_t;
+
+ sub(){}
+ sub(super_t const& s):super_t( s ){}
+
+ BOOST_ASSIGN_V2_CONVERT_CONVERT_MF
+ BOOST_ASSIGN_V2_CONVERT_OPERATOR_MF
+
+ // Relational op
+ //template<typename R1>
+ //bool equal_to(const R1& r)const{
+ // return ::boost::iterator_range_detail::equal(
+ // (*this), r );
+ //}
+ //template<typename R1>
+ //bool less_than(const R& r)const{
+ // return ::boost::iterator_range_detail::less_than(
+ // (*this), r );
+ //}
+
+ };
+
+ template<typename R>
+ sub<R> make_sub(const R& r){ return sub<R>( r ); }
+
+}// chain_aux
+}// v2
+}// assign
+}// boost
+
+#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