Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70348 - in sandbox/assign_v2/boost/assign/v2: framework optional
From: erwann.rogard_at_[hidden]
Date: 2011-03-21 15:31:17


Author: e_r
Date: 2011-03-21 15:31:16 EDT (Mon, 21 Mar 2011)
New Revision: 70348
URL: http://svn.boost.org/trac/boost/changeset/70348

Log:
upd assign_v2
Added:
   sandbox/assign_v2/boost/assign/v2/framework/fun.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/optional/fun.hpp (contents, props changed)

Added: sandbox/assign_v2/boost/assign/v2/framework/fun.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/framework/fun.hpp 2011-03-21 15:31:16 EDT (Mon, 21 Mar 2011)
@@ -0,0 +1,62 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// 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_FRAMEWORK_FUN_ER_2010_HPP
+#define BOOST_ASSIGN_V2_FRAMEWORK_FUN_ER_2010_HPP
+#include <boost/assign/v2/detail/traits/ptr_container/to_value_container.hpp>
+#include <boost/assign/v2/detail/traits/ptr_container/meta.hpp>
+#include <boost/assign/v2/detail/functor/constructor.hpp>
+#include <boost/assign/v2/detail/functor/new.hpp>
+#include <boost/mpl/eval_if.hpp>
+
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+//[syntax_put_fun_deduce
+namespace aux{
+
+ template<typename C>
+ struct container_value{ typedef typename C::value_type type; };
+
+ template<typename /*<<Pointer-container>>*/PtrC>
+ struct /*<<Meta-function mapping the `PtrC`'s pointer-type to a factory thereof>>*/ deduce_fun_pointer/*<-*/
+ {
+ typedef typename v2::ptr_container_aux::to_value_container<
+ PtrC
+ >::type cont_;
+ typedef functor_aux::new_<typename cont_::value_type> type;
+ }/*->*/;
+
+ template<typename /*<<Value-container>>*/C>
+ struct /*<<Meta-function mapping `C`'s value-type to a factory thereof>>*/ deduce_fun_value/*<-*/
+ {
+// typedef typename v2::container_traits::value<C>::type value_type;
+ typedef functor_aux::constructor<typename C::value_type> type;
+ }/*->*/;
+
+ template<typename /*<<Either of a value or pointer-container>>*/C>
+ struct /*<<Meta-function mapping `C`s element-type to a factory thereof>>*/deduce_fun/*<-*/
+ : boost::mpl::eval_if<
+ ptr_container_aux::is_ptr_container<C>,
+ deduce_fun_pointer<C>,
+ deduce_fun_value<C>
+ >
+ {}/*->*/;
+
+
+}// aux
+//]
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_FRAMEWORK_FUN_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/optional/fun.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/optional/fun.hpp 2011-03-21 15:31:16 EDT (Mon, 21 Mar 2011)
@@ -0,0 +1,134 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// 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_OPTIONAL_FUN_ER_2010_HPP
+#define BOOST_ASSIGN_V2_OPTIONAL_FUN_ER_2010_HPP
+#include <boost/assign/v2/detail/pp/ignore.hpp>
+#include <boost/assign/v2/detail/keyword/ignore.hpp>
+#include <boost/assign/v2/framework/fwd.hpp>
+#include <boost/assign/v2/framework/replace_parameter.hpp>
+#include <boost/mpl/apply.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace aux{
+namespace result_of{
+
+ template<typename D>
+ struct modulo_fun{
+
+ typedef aux::replace_fun<D> meta_;
+
+ template<typename F>
+ struct apply : ::boost::mpl::apply1<meta_, F>{};
+
+ };
+
+}// result_of
+
+ template<typename F = keyword_aux::ignore>
+ struct modulo_fun
+ {
+ modulo_fun(){}
+ modulo_fun(F f) : f_( f ){}
+
+ F const& fun()const{ return this->f_; }
+
+ private:
+ F f_;
+ };
+
+ template<typename C, typename F, typename Tag, typename D, typename F1>
+ typename ::boost::mpl::apply1<result_of::modulo_fun<D>, F1>::type
+ operator%(
+ adapter_crtp<C, F, Tag, D> const& lhs,
+ modulo_fun<F1> const& rhs
+ )
+ {
+ typedef result_of::modulo_fun<D> meta_;
+ typedef typename ::boost::mpl::apply1<meta_, F1>::type result_;
+ return result_( lhs.container(), rhs.fun(), lhs.modifier );
+ }
+
+ struct keyword_fun{
+
+ template<typename F>
+ modulo_fun<F> operator=(F const& f)const{
+ return modulo_fun<F>( f );
+ }
+
+ };
+
+}// aux
+namespace{
+ const aux::keyword_fun _fun = aux::keyword_fun();
+}
+//[syntax_put_fun_modulo
+namespace result_of{
+
+ template<typename D>
+ struct modulo_fun/*<-*/
+ : aux::result_of::modulo_fun<D>
+ {}/*->*/;
+
+}// result_of
+//]
+
+
+}// v2
+}// assign
+}// boost
+
+#include <boost/preprocessor/cat.hpp>
+
+#define BOOST_ASSIGN_V2_MODULO_FUN_GENERATE(NAME, FUN)\
+namespace boost{\
+namespace assign{\
+namespace v2{\
+namespace aux{\
+\
+ template<typename T>\
+ modulo_fun< FUN > NAME()\
+ {\
+ return ( v2::_fun = FUN() );\
+ }\
+\
+}\
+using aux::NAME;\
+}\
+}\
+}\
+/**/
+
+#include <boost/assign/v2/detail/functor/constructor.hpp>
+BOOST_ASSIGN_V2_MODULO_FUN_GENERATE(constructor, v2::functor_aux::constructor<T>)
+
+#include <boost/assign/v2/detail/functor/new.hpp>
+BOOST_ASSIGN_V2_MODULO_FUN_GENERATE(new_ptr, v2::functor_aux::new_<T>)
+
+#include <boost/typeof/typeof.hpp>
+#include <boost/type_traits/add_const.hpp>
+#define BOOST_ASSIGN_V2_MODULO_FUN_KEYWORD(NAME, EXPR)\
+namespace boost{\
+namespace assign{\
+namespace v2{\
+ typedef BOOST_TYPEOF( ( _fun = EXPR ) ) BOOST_PP_CAT(type_of,NAME);\
+namespace{\
+\
+ boost::add_const<BOOST_PP_CAT(type_of,NAME)>::type BOOST_PP_CAT(_,NAME) = ( _fun = EXPR );\
+}\
+}\
+}\
+}\
+
+#include <boost/lambda/lambda.hpp>
+BOOST_ASSIGN_V2_MODULO_FUN_KEYWORD(identity, ::boost::lambda::_1)
+
+#endif // BOOST_ASSIGN_V2_OPTIONAL_FUN_ER_2010_HPP


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