|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66540 - in sandbox/statistics/support/boost/assign/v2/ref/static_array: . alloc
From: erwann.rogard_at_[hidden]
Date: 2010-11-12 11:43:14
Author: e_r
Date: 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
New Revision: 66540
URL: http://svn.boost.org/trac/boost/changeset/66540
Log:
adding boost/assign/v2/ref/static_array
Added:
sandbox/statistics/support/boost/assign/v2/ref/static_array/
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/alloc.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc_fwd.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc_fwd.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/interface.hpp (contents, props changed)
sandbox/statistics/support/boost/assign/v2/ref/static_array/static_array.hpp (contents, props changed)
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/alloc.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,16 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_ALLOC_ALLOC_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_ALLOC_ALLOC_ER_2010_HPP
+
+#include <boost/assign/v2/ref/static_array/alloc/fast_alloc.hpp>
+#include <boost/assign/v2/ref/static_array/alloc/lazy_alloc.hpp>
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,68 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_ALLOC_FAST_ALLOC_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_ALLOC_FAST_ALLOC_ER_2010_HPP
+#include <boost/assign/v2/ref/wrapper/wrapper.hpp>
+#include <boost/assign/v2/ref/fusion/assign_array.hpp>
+#include <boost/assign/v2/ref/static_array/interface.hpp>
+#include <boost/assign/v2/ref/static_array/alloc/fast_alloc_fwd.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace alloc_tag{
+ struct fast_alloc{};
+}// alloc_tag
+namespace static_array_aux{
+
+ template<std::size_t N,typename Tag, typename T>
+ class fast_alloc
+ : public static_array_aux::interface<
+ N, Tag, T, fast_alloc<N,Tag,T>
+ >
+ {
+
+ typedef Tag assign_tag_;
+ typedef typename ref::wrapper<assign_tag_,T> wrapper_;
+ typedef boost::array<wrapper_,N> array_;
+
+ public:
+
+ fast_alloc(){}
+
+ template<typename L>
+ fast_alloc(const L& l){
+ assign_array(
+ this->array,
+ l
+ );
+ }
+
+ array_& impl(){
+ return this->array;
+ }
+
+ array_ const & impl()const{
+ return this->array;
+ }
+
+ protected:
+ mutable array_ array;
+
+ };
+
+}// static_array_aux
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc_fwd.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/fast_alloc_fwd.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,29 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_ALLOC_FAST_ALLOC_FWD_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_ALLOC_FAST_ALLOC_FWD_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace alloc_tag{
+ struct fast_alloc;
+}// alloc_tag
+namespace static_array_aux{
+ template<std::size_t N, typename Tag, typename T>
+ class fast_alloc;
+}// static_array_aux
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -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_STATIC_ARRAY_ALLOC_LAZY_ALLOC_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_ALLOC_LAZY_ALLOC_ER_2010_HPP
+#include <boost/shared_ptr.hpp>
+#include <boost/assign/v2/ref/wrapper/wrapper.hpp>
+#include <boost/assign/v2/ref/fusion/assign_array.hpp>
+#include <boost/assign/v2/ref/static_array/alloc/lazy_alloc_fwd.hpp>
+#include <boost/assign/v2/ref/static_array/interface.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace alloc_tag{
+ struct lazy_alloc;
+}// alloc_tag
+namespace static_array_aux{
+
+ template<std::size_t N,typename Tag, typename T, typename D>
+ class lazy_alloc : public static_array_aux::interface<
+ N, Tag, T, lazy_alloc<N,Tag,T,D>
+ >
+ {
+ typedef Tag assign_tag_;
+ typedef typename ref::wrapper<assign_tag_,T> wrapper_;
+ typedef boost::array<wrapper_,N> array_;
+
+ typedef boost::mpl::int_<N> size_;
+
+ void alloc_if()const{
+ if(!this->ptr){
+ return this->alloc();
+ }
+ }
+
+ void alloc()const{
+ this->ptr = smart_ptr_(new array_);
+ assign_array(
+ *this->ptr,
+ static_cast<const D&>(*this)
+ );
+ }
+
+ typedef static_array_aux::interface<
+ N, Tag, T, lazy_alloc
+ > super_t;
+
+ public:
+
+ array_& impl(){
+ this->alloc_if();
+ return (*this->ptr);
+ }
+
+ array_ const & impl()const{
+ this->alloc_if();
+ return (*this->ptr);
+ }
+
+ using super_t::operator[];
+
+ private:
+
+ typedef boost::shared_ptr<array_> smart_ptr_;
+ mutable smart_ptr_ ptr;
+
+ };
+
+}// static_array_aux
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc_fwd.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/alloc/lazy_alloc_fwd.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,29 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_ALLOC_LAZY_ALLOC_FWD_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_ALLOC_LAZY_ALLOC_FWD_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace alloc_tag{
+ struct lazy_alloc;
+}// alloc_tag
+namespace static_array_aux{
+ template<std::size_t N, typename Tag, typename T, typename D>
+ class lazy_alloc;
+}// static_array_aux
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/interface.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/interface.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,241 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_INTERFACE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_INTERFACE_ER_2010_HPP
+#include <algorithm>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/int.hpp>
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/add_const.hpp>
+
+#include <boost/array.hpp>
+#include <boost/range.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/range/algorithm/for_each.hpp>
+#include <boost/range/iterator_range.hpp> //iterator_range_detail::
+
+#include <boost/assign/v2/ref/wrapper/framework.hpp>
+#include <boost/assign/v2/ref/wrapper/crtp.hpp>
+#include <boost/assign/v2/ref/detail/unwrap/range.hpp>
+#include <boost/assign/v2/detail/relational_op/relational_op.hpp>
+#include <boost/assign/v2/put/range/convert.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace static_array_aux{
+
+ template<std::size_t N, typename Tag, typename T>
+ struct interface_traits{
+
+ typedef Tag assign_tag_;
+ typedef typename ref::wrapper<assign_tag_,T> wrapper_;
+ typedef boost::array<wrapper_,N> impl_;
+ typedef typename ref::result_of::unwrap_range<impl_>::type range_;
+ typedef typename ref::result_of::unwrap_range<
+ impl_ const>::type range_c_;
+
+ typedef typename boost::unwrap_reference<T>::type value_type;
+ typedef typename boost::add_reference<value_type>::type reference;
+ typedef typename boost::call_traits<reference>::const_reference
+ const_reference;
+ typedef typename boost::range_iterator<range_>::type iterator;
+ typedef typename boost::range_iterator<range_c_>::type const_iterator;
+ // wrappers
+ #ifndef BOOST_MSVC
+ typedef typename boost::range_size<impl_>::type size_type;
+ #endif
+ #ifdef BOOST_MSVC
+ typedef std::size_t size_type;
+ #endif
+ typedef typename boost::range_difference<range_>::type difference_type;
+
+ };
+
+ // Requirements:
+ // D.impl() Returns an array of ref-wrappers
+ // D.impl()const Returns a const array of ref-wrappers
+ template<std::size_t N, typename Tag, typename T, typename D>
+ class interface
+ : public relational_op_aux::crtp<
+ interface<N, Tag, T, D>
+ >
+ {
+
+ typedef interface_traits<N, Tag, T> traits_;
+ typedef typename traits_::wrapper_ wrapper_;
+ typedef typename traits_::impl_ impl_;
+ typedef interface<N, T, Tag, D> this_;
+
+ typedef typename boost::remove_const<T>::type lvalue_;
+ typedef typename boost::add_const<T>::type rvalue_;
+
+ public:
+ typedef wrapper_ wrapper_type;
+ typedef typename traits_::value_type value_type;
+ typedef typename traits_::iterator iterator;
+ typedef typename traits_::const_iterator const_iterator;
+ typedef typename traits_::size_type size_type;
+ typedef typename traits_::difference_type difference_type;
+ typedef typename traits_::reference reference;
+ typedef typename traits_::const_reference const_reference;
+
+ BOOST_STATIC_CONSTANT(size_type, static_size = N);
+
+ iterator begin()
+ {
+ return boost::begin( this->unwrap() );
+ }
+ iterator end()
+ {
+ return boost::end( this->unwrap() );
+ }
+ const_iterator begin()const
+ {
+ return boost::begin( this->unwrap() );
+ }
+ const_iterator end()const
+ {
+ return boost::end( this->unwrap() );
+ }
+
+ size_type size() const
+ {
+ return this->impl().size();
+ }
+ bool empty() const
+ {
+ return this->impl().empty();
+ }
+
+ wrapper_& get_wrapper(size_type i)
+ {
+ return (this->impl())[i];
+ }
+
+ wrapper_ const& get_wrapper(size_type i)const
+ {
+ return (this->impl())[i];
+ }
+
+ reference operator[](size_type i)
+ {
+ return (this->impl())[i].unwrap();
+ }
+ const_reference operator[](size_type i)const
+ {
+ return (this->impl())[i].unwrap();
+ }
+
+ reference front()
+ {
+ return (this->impl()).front().unwrap();
+ }
+ const_reference front() const
+ {
+ return (this->impl()).front().unwrap();
+ }
+ reference back()
+ {
+ return (this->impl()).back().unwrap();
+ }
+ const_reference back() const
+ {
+ return (this->impl()).back().unwrap();
+ }
+
+ void swap(interface& other)
+ {
+ typedef boost::mpl::int_<N> int_n_;
+ this->swap_impl(other,int_n_());
+ }
+
+ void assign(lvalue_& val){ this->assign_impl<lvalue_>( val ); }
+ void assign(rvalue_& val){ this->assign_impl<rvalue_>( val ); }
+
+ BOOST_ASSIGN_V2_CONVERT_CONVERT_MF
+ BOOST_ASSIGN_V2_CONVERT_OPERATOR_MF
+
+ // Relational op
+
+ template<typename R>
+ bool equal_to(const R& r)const{
+ return ::boost::iterator_range_detail::equal(
+ (*this), r );
+ }
+
+ template<typename R>
+ bool less_than(const R& r)const{
+ return ::boost::iterator_range_detail::less_than(
+ (*this), r );
+ }
+
+ protected:
+ typedef boost::mpl::false_ false_;
+ typedef boost::mpl::true_ true_;
+
+ void swap_impl(interface& other, boost::mpl::int_<0>){}
+
+ template<int N1>
+ void swap_impl(interface& other, boost::mpl::int_<N1>)
+ {
+ reference lhs = (*this)[N1-1];
+ reference rhs = (other)[N1-1];
+ lhs.swap(rhs);
+ typedef boost::mpl::int_<N1-1> next_int_;
+ this->swap_impl( other, next_int_() );
+ }
+
+ typename traits_::range_ unwrap()
+ {
+ return ref::unwrap_range( this->impl() );
+ }
+ typename traits_::range_c_ unwrap()const{
+ return ref::unwrap_range( this->impl() );
+ }
+
+ impl_& impl(){
+ return static_cast<D&>(*this).impl();
+ }
+
+ impl_ const& impl()const{
+ return static_cast<const D&>(*this).impl();
+ }
+
+ template<typename U>
+ void assign_impl(U& val)
+ {
+ impl_& ra = this->impl();
+ boost::for_each(
+ ra,
+ functional::assigner<U>( val )
+ );
+ }
+
+ };
+
+}// static_array_aux
+namespace container_type_traits{
+ // TODO
+
+// template<typename T,std::size_t sz>
+// struct is_static_array<boost::array<T, sz> > : boost::mpl::true_{};
+
+}// container_type_traits
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
Added: sandbox/statistics/support/boost/assign/v2/ref/static_array/static_array.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/static_array/static_array.hpp 2010-11-12 11:43:10 EST (Fri, 12 Nov 2010)
@@ -0,0 +1,16 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_STATIC_ARRAY_STATIC_ARRAY_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_STATIC_ARRAY_STATIC_ARRAY_ER_2010_HPP
+
+#include <boost/assign/v2/ref/static_array/alloc/alloc.hpp>
+#include <boost/assign/v2/ref/static_array/interface.hpp>
+
+#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