Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71043 - in sandbox/assign_v2/boost/assign/v2: option/modifier put/cpp03
From: erwann.rogard_at_[hidden]
Date: 2011-04-06 15:02:16


Author: e_r
Date: 2011-04-06 15:02:14 EDT (Wed, 06 Apr 2011)
New Revision: 71043
URL: http://svn.boost.org/trac/boost/changeset/71043

Log:
upd assign_v2
Added:
   sandbox/assign_v2/boost/assign/v2/option/modifier/row_major.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/put/cpp03/
   sandbox/assign_v2/boost/assign/v2/put/cpp03/csv_put.hpp (contents, props changed)
   sandbox/assign_v2/boost/assign/v2/put/cpp03/delayed_csv_put.hpp (contents, props changed)

Added: sandbox/assign_v2/boost/assign/v2/option/modifier/row_major.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/option/modifier/row_major.hpp 2011-04-06 15:02:14 EDT (Wed, 06 Apr 2011)
@@ -0,0 +1,109 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_OPTION_MODIFIER_ROW_MAJOR_ER_2010_HPP
+#define BOOST_ASSIGN_V2_OPTION_MODIFIER_ROW_MAJOR_ER_2010_HPP
+#include <cstddef>
+#include <boost/assert.hpp>
+#include <boost/assign/v2/detail/config/enable_cpp0x.hpp>
+#include <boost/assign/v2/detail/keyword.hpp>
+#include <boost/assign/v2/option/modifier/framework.hpp>
+#include <boost/call_traits.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <utility>
+#endif
+
+namespace boost{
+namespace assign{
+namespace v2{
+//[syntax_option_row_major
+namespace modifier_tag{
+ struct row_major{};
+}// modifier_tag
+namespace interpreter_aux{
+
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#define BOOST_ASSIGN_V2_arg T&& t
+#define BOOST_ASSIGN_V2_forward std::forward<T>( t )
+#else
+#define BOOST_ASSIGN_V2_arg T const& t
+#define BOOST_ASSIGN_V2_forward t
+#endif
+
+ template<std::size_t Dim, std::size_t NumDims, bool exit = Dim == NumDims>
+ struct row_major
+ {
+ typedef std::size_t size_type;
+ typedef row_major<Dim + 1, NumDims> nested_;
+
+ template<typename Array, typename T>
+ static void assign(Array& array, size_type remainder, BOOST_ASSIGN_V2_arg )
+ {
+ size_type n = array.num_elements() / array.size();
+ size_type j = remainder / n;
+ typename Array::reference sub = array[ j ];
+ nested_::assign( sub, remainder - ( j * n ), BOOST_ASSIGN_V2_forward );
+ }
+ };
+
+ template<std::size_t Dim, std::size_t NumDims>
+ struct row_major<Dim, NumDims, true>
+ {
+ typedef std::size_t size_type;
+
+ template<typename E, typename T>
+ static void assign(E& elem, size_type index, BOOST_ASSIGN_V2_arg)
+ {
+ elem = BOOST_ASSIGN_V2_forward;
+ }
+ };
+
+ template<typename Array, typename T>
+ void row_major_assign(Array& array, std::size_t index, BOOST_ASSIGN_V2_arg)
+ {
+ typedef row_major<0, Array::dimensionality> row_major_;
+ row_major_::assign( array, index, BOOST_ASSIGN_V2_forward );
+ }
+
+ template<>
+ class interpreter_modifier< modifier_tag::row_major >
+ {
+
+ typedef std::size_t size_type;
+
+ public:
+ interpreter_modifier()
+ : index_( 0 )
+ {}
+ interpreter_modifier( ignore_, size_type n )
+ : index_( n )
+ {}
+
+ template<typename C, typename T>
+ void impl(C& cont, BOOST_ASSIGN_V2_arg, data_tag::value )const
+ {
+ row_major_assign( cont, this->index_++, BOOST_ASSIGN_V2_forward );
+ }
+
+ private:
+ mutable size_type index_;
+ };
+
+#undef BOOST_ASSIGN_V2_arg
+#undef BOOST_ASSIGN_V2_forward
+
+}// interpreter_aux
+//]
+BOOST_ASSIGN_V2_OPTION_MODIFIER_KEYWORD(row_major)
+BOOST_ASSIGN_V2_OPTION_MODIFIER_META_MODIFIER_TAG(row_major, modifier_tag::row_major)
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_OPTION_MODIFIER_ROW_MAJOR_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/put/cpp03/csv_put.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/cpp03/csv_put.hpp 2011-04-06 15:02:14 EDT (Wed, 06 Apr 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_PUT_CPP03_CSV_PUT_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_CPP03_CSV_PUT_ER_2010_HPP
+#include <boost/assign/v2/detail/config/limit_csv_arity.hpp>
+#include <boost/preprocessor/control.hpp>
+#include <boost/preprocessor/repetition.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace interpreter_aux{
+
+#define BOOST_ASSIGN_V2_MACRO(z, N, is_const)\
+ template<typename C, typename O, BOOST_PP_ENUM_PARAMS(N, typename T)>\
+ typename boost::enable_if<\
+ is_option_crtp<O>\
+ >::type csv_put(\
+ C& cont, O const& options,\
+ BOOST_PP_ENUM_BINARY_PARAMS(N, T, BOOST_PP_EXPR_IF(is_const, const)& _)\
+ )\
+ {\
+ csv(\
+ make_csv_ready( put( cont ) % options ) \
+ , BOOST_PP_ENUM_PARAMS(N, _)\
+ );\
+ }\
+ template<typename C, BOOST_PP_ENUM_PARAMS(N, typename T)>\
+ typename boost::disable_if<\
+ is_option_crtp<T0>\
+ >::type csv_put(\
+ C& cont,\
+ BOOST_PP_ENUM_BINARY_PARAMS(N, T, BOOST_PP_EXPR_IF(is_const, const)& _)\
+ )\
+ {\
+ csv( make_csv_ready( put( cont ) ), BOOST_PP_ENUM_PARAMS(N, _) );\
+ }\
+/**/
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 0
+)
+BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_ASSIGN_V2_LIMIT_CSV_ARITY),
+ BOOST_ASSIGN_V2_MACRO,
+ 1
+)
+#undef BOOST_ASSIGN_V2_MACRO
+
+}// interpreter_aux
+using interpreter_aux::csv_put;
+}// v2
+}// assign
+}// boost
+
+#endif // BOOST_ASSIGN_V2_PUT_CPP03_CSV_PUT_ER_2010_HPP

Added: sandbox/assign_v2/boost/assign/v2/put/cpp03/delayed_csv_put.hpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/boost/assign/v2/put/cpp03/delayed_csv_put.hpp 2011-04-06 15:02:14 EDT (Wed, 06 Apr 2011)
@@ -0,0 +1,9 @@
+/*
+ * delayed_csv_put.hpp
+ * as2
+ *
+ * Created by erwann on 4/6/11.
+ * Copyright 2011 __MyCompanyName__. All rights reserved.
+ *
+ */
+


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