Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69797 - in sandbox/assign_v2/boost/assign/v2/ref/array: . cpp03 cpp0x
From: erwann.rogard_at_[hidden]
Date: 2011-03-09 16:23:04


Author: e_r
Date: 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
New Revision: 69797
URL: http://svn.boost.org/trac/boost/changeset/69797

Log:
upd assign_v2
Added:
   sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/array/cpp03/
   sandbox/assign_v2/boost/assign/v2/ref/array/cpp03/csv_array.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/array/cpp0x/
   sandbox/assign_v2/boost/assign/v2/ref/array/cpp0x/csv_array.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp (contents, props changed)
Removed:
   sandbox/assign_v2/boost/assign/v2/ref/array/tag1.hpp

Added: sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/array.hpp 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_ARRAY_ARRAY_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_ARRAY_ARRAY_ER_2010_HPP
+#include <boost/assign/v2/ref/array/alloc/lazy.hpp>
+#include <boost/assign/v2/ref/array/size_type.hpp>
+#include <boost/assign/v2/ref/list/list.hpp>
+#include <boost/assign/v2/ref/list/array.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace array_aux{
+
+ template<typename T>
+ struct empty_array : empty_list<list_aux::array_tag>{};
+
+ template<size_type N, typename T>
+ struct recursive_result
+ {
+ typedef typename recursive_result<N-1, T>::type previous_;
+ typedef typename previous_::template result<T&>::type type;
+ };
+
+ template<typename T>
+ struct recursive_result<0, T> : empty_array<T>{};
+
+}// array_aux
+namespace nth_result_of{
+
+ template<array_size_type N, typename T>
+ struct array
+ : array_aux::recursive_result<N, T>
+ {};
+
+}// nth_result_of
+namespace result_of{
+
+ template<typename U, typename T = U>
+ struct array
+ : nth_result_of::array<1, U>{};
+
+ template<typename U>
+ struct array<U, keyword_aux::nil>
+ : nth_result_of::array<0, U>{};
+
+}// result_of
+
+ template<typename T>
+ typename result_of::array<T, keyword_aux::nil>::type
+ array( keyword_aux::nil )
+ {
+ return ref::list<list_aux::array_tag>( v2::_nil );
+ }
+
+ template<typename T>
+ typename result_of::array<T>::type
+ array(T& t)
+ {
+ return array<T>( v2::_nil )( t );
+ }
+
+ template<typename T>
+ typename result_of::array<T const>::type
+ array(T const & t)
+ {
+ return array<T const>( v2::_nil )( t );
+ }
+
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_REF_ARRAY_ARRAY_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/ref/array/cpp03/csv_array.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/cpp03/csv_array.hpp 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,70 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_ARRAY_CPP03_CSV_ARRAY_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_ARRAY_CPP03_CSV_ARRAY_ER_2010_HPP
+#include <boost/assign/v2/detail/keyword/nil.hpp>
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/assign/v2/ref/array/csv/common.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+
+#define BOOST_ASSIGN_V2_MACRO1(z, i, data) result.rebind(i, BOOST_PP_CAT(data, i) );
+#define BOOST_ASSIGN_V2_MACRO2(N, U)\
+ template<typename T>\
+ typename nth_result_of::csv_array<N, U>::type\
+ csv_array( BOOST_PP_ENUM_PARAMS( N, U& _) ){ \
+ return csv_array_impl<U>( BOOST_PP_ENUM_PARAMS( N, _ ) );\
+ }\
+/**/
+#define BOOST_ASSIGN_V2_MACRO3(z, N, data)\
+\
+ template<typename U>\
+ typename nth_result_of::csv_array<N, U>::type\
+ csv_array_impl( BOOST_PP_ENUM_PARAMS( N, U& _ ) )\
+ {\
+ typedef typename nth_result_of::csv_array<N, U>::type result_;\
+ result_ result; BOOST_PP_REPEAT( N, BOOST_ASSIGN_V2_MACRO1, _ )\
+ return result;\
+ }\
+ BOOST_ASSIGN_V2_MACRO2(N, T)\
+ BOOST_ASSIGN_V2_MACRO2(N, T const)\
+\
+/**/
+
+
+namespace array_aux{
+
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO3,
+ ~
+)
+#undef BOOST_ASSIGN_V2_MACRO1
+#undef BOOST_ASSIGN_V2_MACRO2
+#undef BOOST_ASSIGN_V2_MACRO3
+
+}// array_aux
+
+using array_aux::csv_array;
+
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_REF_ARRAY_CPP03_CSV_ARRAY_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/ref/array/cpp0x/csv_array.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/cpp0x/csv_array.hpp 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,97 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_ARRAY_CPP0X_CSV_ARRAY_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_ARRAY_CPP0X_CSV_ARRAY_ER_2010_HPP
+#include <utility>
+#include <boost/assign/v2/ref/array/csv/common.hpp>
+#include <boost/assign/v2/detail/traits/type/or_const.hpp>
+#include <boost/config.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace array_aux{
+namespace result_of{
+
+ template<typename U, typename... Args>
+ struct csv_array : nth_result_of::csv_array<
+ 1 + sizeof...(Args), U
+ >
+ {};
+
+}// result_of
+
+ template<size_type I, typename R>
+ void csv_assign( R& result ){}
+
+ template<size_type I, typename R, typename U, typename... Args>
+ void csv_assign( R& result, U& u, Args&...args )
+ {
+ typedef typename R::wrapper_type wrapper_;
+ r.rebind( I::value, u );
+ csv_assign<I + 1>( result, args... );
+ }
+
+ template<typename U, typename... Args>
+ struct csv_helper
+ {
+ typedef typename result_of::csv_array<U, Args...>::type type;
+
+ static type call( U& u, Args&...args )
+ {
+ type result;
+ csv_assign<0>( result, u, args... );
+ return result;
+ }
+
+ };
+
+ template<typename T, typename...Args>
+ typename boost::lazy_disable_if<
+ v2::type_traits::or_const<T, Args...>,
+ result_of::csv_array<T, Args...>
+ >::type
+ csv_array( T& t, Args&...args )
+ {
+ return csv_helper<T, Args...>::call( t, args... );
+ }
+
+ template<typename T, typename...Args>
+ typename result_of::csv_array<T const, Args const...>
+ csv_array( T const& t, Args const&...args )
+ {
+ return csv_helper<T const, Args const ...>::call( t, args... );
+ }
+
+}// array_aux
+
+using array_aux::csv_array;
+
+//[result_of_csv_array
+namespace result_of{
+
+ template<typename /*<<U& has to be a reference>>*/U, typename... Args>
+ struct csv_array : nth_result_of::csv_array<
+ 1 + sizeof...(Args), U
+ >
+ {};
+
+}// result_of
+//]
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_REF_ARRAY_CPP0X_CSV_ARRAY_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/ref/array/csv_array.hpp 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,66 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_ARRAY_CSV_ARRAY_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_ARRAY_CSV_ARRAY_ER_2010_HPP
+#include <boost/assign/v2/detail/keyword/nil.hpp>
+#include <boost/assign/v2/ref/array/alloc/instant.hpp>
+#include <boost/assign/v2/ref/array/size_type.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace array_aux{
+namespace nth_result_of{
+
+ template<array_size_type N, typename U>
+ struct csv_array
+ {
+ typedef array_aux::instant_alloc<N, U> type;
+ };
+
+}// result_of
+
+ template<typename U>
+ typename nth_result_of::csv_array<0, U>::type
+ csv_array( keyword_aux::nil )
+ {
+ typedef typename nth_result_of::csv_array<0, U>::type result_;
+ return result_();
+ }
+
+}// array_aux
+using array_aux::csv_array;
+//[nth_result_of
+namespace nth_result_of{
+
+ template<array_size_type N, typename /*<<U& has to be a reference>>*/U>
+ struct /*<<Meta-function>>*/csv_array
+ //<-
+ : array_aux::nth_result_of::csv_array<N, U>
+ //->
+ {};
+
+}// nth_result_of
+//]
+}// ref
+}// v2
+}// assign
+}// boost
+
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <boost/assign/v2/ref/array/cpp0x/csv_array.hpp>
+#else
+#include <boost/assign/v2/ref/array/cpp03/csv_array.hpp>
+#endif // BOOST_ASSIGN_V2_ENABLE_CPP0X
+
+#endif // BOOST_ASSIGN_V2_REF_ARRAY_CSV_ARRAY_ER_2010_HPP

Deleted: sandbox/assign_v2/boost/assign/v2/ref/array/tag1.hpp
==============================================================================
--- sandbox/assign_v2/boost/assign/v2/ref/array/tag1.hpp 2011-03-09 16:22:59 EST (Wed, 09 Mar 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
\ 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