Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69639 - in sandbox/assign_v2/boost/assign/v2/ref/tuple: . cpp03 cpp0x
From: erwann.rogard_at_[hidden]
Date: 2011-03-07 20:15:43


Author: e_r
Date: 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
New Revision: 69639
URL: http://svn.boost.org/trac/boost/changeset/69639

Log:
upd assign_v2
Added:
   sandbox/assign_v2/boost/assign/v2/ref/tuple/as_arglist.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp03/
   sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp03/as_arglist.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/
   sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/as_arglist.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/data.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/tuple/data.hpp (contents, props changed)

Added: sandbox/assign_v2/boost/assign/v2/ref/tuple/as_arglist.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/tuple/as_arglist.hpp 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_REF_TUPLE_AS_ARGLIST_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_TUPLE_AS_ARGLIST_ER_2010_HPP
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <boost/assign/v2/ref/tuple/cpp0x/as_arglist.hpp>
+#else
+#include <boost/assign/v2/ref/tuple/cpp03/as_arglist.hpp>
+#endif
+#endif // BOOST_ASSIGN_V2_REF_TUPLE_AS_ARGLIST_ER_2010_HPP
\ No newline at end of file

Added: sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp03/as_arglist.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp03/as_arglist.hpp 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
@@ -0,0 +1,46 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_REF_TUPLE_CPP03_AS_ARGLIST_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_TUPLE_CPP03_AS_ARGLIST_ER_2010_HPP
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/assign/v2/detail/config/limit_arity.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+
+#define BOOST_ASSIGN_V2_MACRO1(z, I, data) ::boost::get<I>( data )
+#define BOOST_ASSIGN_V2_MACRO(z, N, data)\
+ template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(N, typename T)>\
+ void as_arglist(\
+ F const& f,\
+ ::boost::tuples::tuple<BOOST_PP_ENUM_PARAMS(N, T)> const& t\
+ )\
+ {\
+ f( BOOST_PP_ENUM(N, BOOST_ASSIGN_V2_MACRO1, t) );\
+ }\
+/**/
+BOOST_PP_REPEAT(
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ ~
+)
+#undef BOOST_ASSIGN_V2_MACRO1
+#undef BOOST_ASSIGN_V2_MACRO
+
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/as_arglist.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/as_arglist.hpp 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
@@ -0,0 +1,53 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_REF_TUPLE_CPP0X_AS_ARGLIST_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_TUPLE_CPP0X_AS_ARGLIST_ER_2010_HPP
+#include <boost/assign/v2/ref/tuple/cpp0x/data.hpp>
+#include <boost/assign/v2/temporary/variadic_args_to_indices.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace tuple_aux{
+
+ // --- Implementation --- //
+
+ template<typename F, typename T, typename I, I ...Values>
+ void as_arglist_helper(
+ F const& f,
+ T const& t,
+ ::boost::mpl::er2010::indices<I, Values...>
+ )
+ {
+ f( ref::get<Values>( t )... );
+ }
+
+ template<typename F, typename ...Args>
+ void as_arglist(
+ F const& f,
+ data<Args...> const& t
+ )
+ {
+ typedef typename ::boost::mpl::er2010::args_to_indices<
+ int,
+ Args...
+ >::type indices_;
+ as_arglist_helper( f, t, indices_() );
+ }
+
+}// tuple_aux
+using tuple_aux::as_arglist;
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/data.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/tuple/cpp0x/data.hpp 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
@@ -0,0 +1,124 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_REF_TUPLE_CPP0X_DATA_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_TUPLE_CPP0X_DATA_ER_2010_HPP
+#include <utility>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/assign/v2/ref/tuple/cpp0x.hpp>
+
+// This tuple variant keeps a copy of rvalue reference. Expression templates
+// involving references to tuples otheriwse cause runtime errors in Release mode under OS X.
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace tuple_aux{
+
+ template<typename ...Args>
+ struct data
+ {
+ data(){}
+ };
+
+ template<typename T, bool is_ref = boost::is_reference<T>::value>
+ struct traits
+ {
+ typedef typename boost::add_reference<T>::type ref_type;
+ typedef ref_type value_type;
+ };
+
+ template<typename T>
+ struct traits<T, false>
+ {
+ typedef typename boost::add_const<T>::type value_type;
+ typedef typename boost::add_reference<value_type>::type ref_type;
+ };
+
+ template<typename T, typename ...Args>
+ struct data<T, Args...> : data<Args...>
+ {
+ typedef data<Args...> super_t;
+
+ data(T&& t, Args&&...args)
+ : super_t(
+ std::forward<Args>( args )...
+ ),
+ value(
+ std::forward<T>( t )
+ ) {}
+
+ typedef tuple_aux::traits<T> traits_;
+ typedef typename traits_::value_type value_type;
+
+ value_type value;
+
+ };
+
+ template<int index, int acc, typename...Args>
+ struct get_helper{};
+
+ template<int index, int acc, typename T, typename... Args>
+ struct get_helper<index, acc, T, Args...>
+ : get_helper<index, acc + 1, Args...>{};
+
+ template<int index, typename T, typename... Args>
+ struct get_helper<index, index, T, Args...>
+ {
+ typedef data<T, Args...> data_;
+ typedef ref::tuple_aux::traits<T> traits_;
+ typedef typename traits_::ref_type type;
+
+ template<typename U>
+ static type call(U const& u)
+ {
+ data_ const& t = u;
+ return t.value;
+ }
+ };
+
+}// tuple_aux
+namespace result_of{
+
+ template<typename... Args>
+ struct tuple
+ {
+ typedef tuple_aux::data<Args...> type;
+ };
+
+ template<int index, typename... Args>
+ struct get_tuple : tuple_aux::get_helper<index, 0 , Args...>{};
+
+}// result_of
+
+ template<typename ... Args>
+ typename result_of::tuple<Args...>::type
+ tuple(Args&&...args)
+ {
+ typedef typename result_of::tuple<Args...>::type result_;
+ return result_( std::forward<Args>( args )... );
+ }
+
+ template<int index, typename... Args>
+ typename result_of::get_tuple<index, Args...>::type
+ get(tuple_aux::data<Args...> const& t)
+ {
+ typedef result_of::get_tuple<index, Args...> caller_;
+ return caller_::call( t );
+ }
+
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/assign_v2/boost/assign/v2/ref/tuple/data.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/tuple/data.hpp 2011-03-07 20:15:40 EST (Mon, 07 Mar 2011)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_REF_TUPLE_DATA_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_TUPLE_DATA_ER_2010_HPP
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <boost/assign/v2/ref/tuple/cpp0x/data.hpp>
+#else
+#include <boost/tuple/tuple.hpp>
+#endif
+#endif // BOOST_ASSIGN_V2_REF_TUPLE_DATA_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