Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66854 - in sandbox/statistics/support/boost/assign/v2: put/modifier put/modifier/ext temporary
From: erwann.rogard_at_[hidden]
Date: 2010-11-29 16:01:01


Author: e_r
Date: 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
New Revision: 66854
URL: http://svn.boost.org/trac/boost/changeset/66854

Log:
small reorganization to boost/assign/v2
Added:
   sandbox/statistics/support/boost/assign/v2/put/modifier/ext.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/modifier/ext/concept_parameter.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/put/modifier/ext/result_of_modulo.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/temporary/
   sandbox/statistics/support/boost/assign/v2/temporary/chain_iterator.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/temporary/variadic_sequence.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/temporary/variadic_vector.hpp (contents, props changed)

Added: sandbox/statistics/support/boost/assign/v2/put/modifier/ext.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/modifier/ext.hpp 2010-11-29 16:00:58 EST (Mon, 29 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_PUT_MODIFIER_EXT_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_MODIFIER_EXT_ER_2010_HPP
+
+#include <boost/assign/v2/put/modifier/ext/incr_lookup.hpp>
+#include <boost/assign/v2/put/modifier/ext/repeat.hpp>
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/modifier/ext/concept_parameter.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/modifier/ext/concept_parameter.hpp 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_MODIFIER_EXT_CONCEPT_PARAMETER_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_MODIFIER_EXT_CONCEPT_PARAMETER_ER_2010_HPP
+#include <boost/concept_check.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace put_concept{
+
+ // P models Param with respect to modifier M
+ template<typename M, typename P>
+ struct Parameter
+ {
+
+ BOOST_CONCEPT_USAGE(Parameter)
+ {
+ M m( p.get() );
+ }
+
+ private:
+ static P & p;
+ };
+
+}// put_concept
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/put/modifier/ext/result_of_modulo.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/put/modifier/ext/result_of_modulo.hpp 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
@@ -0,0 +1,96 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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_MODIFIER_EXT_RESULT_OF_MODULO_ER_2010_HPP
+#define BOOST_ASSIGN_V2_PUT_MODIFIER_EXT_RESULT_OF_MODULO_ER_2010_HPP
+#include <boost/concept/assert.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/assign/v2/put/generic/base.hpp>
+#include <boost/assign/v2/put/generic/new_fun.hpp>
+#include <boost/assign/v2/put/generic/new_modifier.hpp>
+#include <boost/assign/v2/put/generic/parameter.hpp>
+#include <boost/assign/v2/put/generic/result_of_modulo.hpp>
+#include <boost/assign/v2/put/modifier/ext/concept_parameter.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace result_of_modulo{
+
+ template<typename T>
+ struct ext_generic{
+
+ template<typename FParameter>
+ struct apply{
+
+ typedef typename T::fun_type old_fun_;
+ typedef typename T::modifier_tag old_tag;
+ typedef typename boost::mpl::apply2<
+ FParameter,
+ old_fun_,
+ old_tag
+ >::type pair_;
+ typedef typename pair_::fun_type fun_;
+ typedef typename pair_::modifier_tag tag;
+
+ typedef typename boost::is_same<fun_, old_fun_>::type is_same_fun;
+
+ typedef typename boost::mpl::eval_if<
+ is_same_fun,
+ boost::mpl::apply1<
+ v2::result_of_modulo::new_modifier<T>,
+ tag
+ >,
+ boost::mpl::apply2<
+ v2::result_of_modulo::new_fun_modifier<T>,
+ fun_,
+ tag
+ >
+ >::type type;
+
+ typedef put_aux::modifier<tag> m_;
+
+ template<typename V, typename F>
+ static type call(V& v, F const& f, m_ const& m)
+ {
+ return type( v, f, m );
+ }
+ static fun_ make_fun(const T& t, boost::mpl::false_)
+ {
+ return fun_();
+ }
+ static fun_ make_fun(const T& t, boost::mpl::true_)
+ {
+ return t.fun;
+ }
+ template<typename P>
+ static type call(const T& t, P const& p)
+ {
+ typedef put_concept::Parameter<m_,P> concept_;
+ BOOST_CONCEPT_ASSERT(( concept_ ));
+ return call(
+ t.unwrap(),
+ make_fun( t, is_same_fun() ),
+ m_( p.get() )
+ );
+ }
+
+ };
+
+ };
+
+}// result_of_modulo_aux
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/temporary/chain_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/temporary/chain_iterator.hpp 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
@@ -0,0 +1,358 @@
+// Boost.Range library
+//
+// Copyright Neil Groves 2009. Use, modification and
+// distribution is 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)
+//
+//
+// For more information, see http://www.boost.org/libs/range/
+//
+
+#ifndef BOOST_RANGE_DETAIL_CHAIN_ITERATOR_HPP_INCLUDED
+#define BOOST_RANGE_DETAIL_CHAIN_ITERATOR_HPP_INCLUDED
+
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/empty.hpp>
+#include <boost/range/detail/demote_iterator_traversal_tag.hpp>
+#include <boost/range/value_type.hpp>
+#include <boost/utility.hpp>
+
+namespace boost
+{
+ namespace range_detail
+ {
+
+template<typename Iterator1, typename Iterator2>
+struct chain_iterator_link
+{
+private:
+ class reference_count_t
+ {
+ public:
+ reference_count_t() : m_count(0u) {}
+ reference_count_t(const reference_count_t&) : m_count(0u) {}
+ reference_count_t& operator=(const reference_count_t&) { return *this; }
+
+ void increment() { ++m_count; }
+ bool decrement() { return --m_count ? false : true; }
+
+ private:
+ unsigned int m_count;
+ };
+
+public:
+ chain_iterator_link(Iterator1 last1, Iterator2 first2)
+ : last1(last1)
+ , first2(first2)
+ {
+ }
+
+ void add_reference() const
+ {
+ count.increment();
+ }
+
+ bool release_reference() const
+ {
+ return count.decrement();
+ }
+
+ Iterator1 last1;
+ Iterator2 first2;
+
+private:
+ chain_iterator_link() /* = delete */ ;
+
+ mutable reference_count_t count;
+};
+} // range_detail
+
+template<typename Iterator1, typename Iterator2>
+inline void intrusive_ptr_add_ref(const range_detail::chain_iterator_link<Iterator1,Iterator2>* p)
+{
+ p->add_reference();
+}
+
+template<typename Iterator1, typename Iterator2>
+inline void intrusive_ptr_release(const range_detail::chain_iterator_link<Iterator1,Iterator2>* p)
+{
+ if (p->release_reference())
+ delete p;
+}
+
+namespace range_detail
+{
+
+class chain_iterator_begin_tag {};
+class chain_iterator_end_tag {};
+
+template<typename Iterator1
+ , typename Iterator2
+ , typename Reference
+>
+class chain_iterator_union
+{
+public:
+ typedef Iterator1 iterator1_t;
+ typedef Iterator2 iterator2_t;
+
+ chain_iterator_union() {}
+ chain_iterator_union(unsigned int /*selected*/, const iterator1_t& it1, const iterator2_t& it2) : m_it1(it1), m_it2(it2) {}
+
+ iterator1_t& it1() { return m_it1; }
+ const iterator1_t& it1() const { return m_it1; }
+
+ iterator2_t& it2() { return m_it2; }
+ const iterator2_t& it2() const { return m_it2; }
+
+ Reference dereference(unsigned int selected) const
+ {
+ return selected ? *m_it2 : *m_it1;
+ }
+
+ bool equal(const chain_iterator_union& other, unsigned int selected) const
+ {
+ return selected
+ ? m_it2 == other.m_it2
+ : m_it1 == other.m_it1;
+ }
+
+private:
+ iterator1_t m_it1;
+ iterator2_t m_it2;
+};
+
+template<class Iterator, class Reference>
+class chain_iterator_union<Iterator, Iterator, Reference>
+{
+public:
+ typedef Iterator iterator1_t;
+ typedef Iterator iterator2_t;
+
+ chain_iterator_union() {}
+
+ chain_iterator_union(unsigned int selected, const iterator1_t& it1, const iterator2_t& it2)
+ : m_it(selected ? it2 : it1)
+ {
+ }
+
+ iterator1_t& it1() { return m_it; }
+ const iterator1_t& it1() const { return m_it; }
+
+ iterator2_t& it2() { return m_it; }
+ const iterator2_t& it2() const { return m_it; }
+
+ Reference dereference(unsigned int) const
+ {
+ return *m_it;
+ }
+
+ bool equal(const chain_iterator_union& other, unsigned int selected) const
+ {
+ return m_it == other.m_it;
+ }
+
+private:
+ iterator1_t m_it;
+};
+
+template<typename Iterator1
+ , typename Iterator2
+ , typename ValueType = typename iterator_value<Iterator1>::type
+ , typename Reference = typename iterator_reference<Iterator1>::type
+ , typename Traversal = typename demote_iterator_traversal_tag<
+ typename iterator_traversal<Iterator1>::type
+ , typename iterator_traversal<Iterator2>::type>::type
+>
+class chain_iterator
+ : public iterator_facade<chain_iterator<Iterator1,Iterator2,ValueType,Reference,Traversal>, ValueType, Traversal, Reference>
+{
+ typedef chain_iterator_link<Iterator1, Iterator2> link_t;
+ typedef chain_iterator_union<Iterator1, Iterator2, Reference> iterator_union;
+public:
+ typedef Iterator1 iterator1_t;
+ typedef Iterator2 iterator2_t;
+
+ chain_iterator() : m_section(0u) {}
+
+ chain_iterator(unsigned int section, Iterator1 current1, Iterator1 last1, Iterator2 first2, Iterator2 current2)
+ : m_section(section)
+ , m_it(section, current1, current2)
+ , m_link(new link_t(last1, first2))
+ {
+ }
+
+ template<typename Range1, typename Range2>
+ chain_iterator(Range1& r1, Range2& r2, chain_iterator_begin_tag)
+ : m_section(boost::empty(r1) ? 1u : 0u)
+ , m_it(boost::empty(r1) ? 1u : 0u, boost::begin(r1), boost::begin(r2))
+ , m_link(new link_t(boost::end(r1), boost::begin(r2)))
+ {
+ }
+
+ template<typename Range1, typename Range2>
+ chain_iterator(const Range1& r1, const Range2& r2, chain_iterator_begin_tag)
+ : m_section(boost::empty(r1) ? 1u : 0u)
+ , m_it(boost::empty(r1) ? 1u : 0u, boost::const_begin(r1), boost::const_begin(r2))
+ , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2)))
+ {
+ }
+
+ template<typename Range1, typename Range2>
+ chain_iterator(Range1& r1, Range2& r2, chain_iterator_end_tag)
+ : m_section(1u)
+ , m_it(1u, boost::end(r1), boost::end(r2))
+ , m_link(new link_t(boost::end(r1), boost::begin(r2)))
+ {
+ }
+
+ template<typename Range1, typename Range2>
+ chain_iterator(const Range1& r1, const Range2& r2, chain_iterator_end_tag)
+ : m_section(1u)
+ , m_it(1u, boost::end(r1), boost::end(r2))
+// , m_it(1u, boost::const_end(r1), boost::const_end(r2))
+ , m_link(new link_t(boost::end(r1), boost::begin(r2)))
+// , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2)))
+ {
+ }
+
+private:
+ void increment()
+ {
+ if (m_section)
+ ++m_it.it2();
+ else
+ {
+ ++m_it.it1();
+ if (m_it.it1() == m_link->last1)
+ {
+ m_it.it2() = m_link->first2;
+ m_section = 1u;
+ }
+ }
+ }
+
+ void decrement()
+ {
+ if (m_section)
+ {
+ if (m_it.it2() == m_link->first2)
+ {
+ m_it.it1() = boost::prior(m_link->last1);
+ m_section = 0u;
+ }
+ else
+ --m_it.it2();
+ }
+ else
+ --m_it.it1();
+ }
+
+ typename chain_iterator::reference dereference() const
+ {
+ return m_it.dereference(m_section);
+ }
+
+ bool equal(const chain_iterator& other) const
+ {
+ return m_section == other.m_section
+ && m_it.equal(other.m_it, m_section);
+ }
+
+ void advance(typename chain_iterator::difference_type offset)
+ {
+ if (m_section)
+ advance_from_range2(offset);
+ else
+ advance_from_range1(offset);
+ }
+
+ typename chain_iterator::difference_type distance_to(const chain_iterator& other) const
+ {
+ typename chain_iterator::difference_type result;
+ if (m_section)
+ {
+ if (other.m_section)
+ result = other.m_it.it2() - m_it.it2();
+ else
+ {
+ result = (m_link->first2 - m_it.it2())
+ + (other.m_it.it1() - m_link->last1);
+
+ BOOST_ASSERT( result <= 0 );
+ }
+ }
+ else
+ {
+ if (other.m_section)
+ {
+ result = (m_link->last1 - m_it.it1())
+ + (other.m_it.it2() - m_link->first2);
+ }
+ else
+ result = other.m_it.it1() - m_it.it1();
+ }
+ return result;
+ }
+
+ void advance_from_range2(typename chain_iterator::difference_type offset)
+ {
+ typedef typename chain_iterator::difference_type difference_t;
+ BOOST_ASSERT( m_section == 1u );
+ if (offset < 0)
+ {
+ difference_t r2_dist = m_link->first2 - m_it.it2();
+ BOOST_ASSERT( r2_dist <= 0 );
+ if (offset >= r2_dist)
+ std::advance(m_it.it2(), offset);
+ else
+ {
+ difference_t r1_dist = offset - r2_dist;
+ BOOST_ASSERT( r1_dist <= 0 );
+ m_it.it1() = m_link->last1 + r1_dist;
+ m_section = 0u;
+ }
+ }
+ else
+ std::advance(m_it.it2(), offset);
+ }
+
+ void advance_from_range1(typename chain_iterator::difference_type offset)
+ {
+ typedef typename chain_iterator::difference_type difference_t;
+ BOOST_ASSERT( m_section == 0u );
+ if (offset > 0)
+ {
+ difference_t r1_dist = m_link->last1 - m_it.it1();
+ BOOST_ASSERT( r1_dist >= 0 );
+ if (offset < r1_dist)
+ std::advance(m_it.it1(), offset);
+ else
+ {
+ difference_t r2_dist = offset - r1_dist;
+ BOOST_ASSERT( r2_dist >= 0 );
+ m_it.it2() = m_link->first2 + r2_dist;
+ m_section = 1u;
+ }
+ }
+ else
+ std::advance(m_it.it1(), offset);
+ }
+
+ unsigned int m_section;
+ iterator_union m_it;
+ intrusive_ptr<const link_t> m_link;
+
+ friend class ::boost::iterator_core_access;
+};
+
+ } // namespace range_detail
+
+} // namespace boost
+#endif // include guard
+
+

Added: sandbox/statistics/support/boost/assign/v2/temporary/variadic_sequence.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/temporary/variadic_sequence.hpp 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////
+// variadic_sequence.hpp //
+// //
+// 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_MPL_DETAIL_VARIADIC_SEQUENCE_HPP_ER_2010
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_HPP_ER_2010
+#include <boost/preprocessor/repetition/enum.hpp>
+
+namespace boost{
+namespace mpl{
+namespace detail{
+namespace variadic_sequence_aux{
+
+// Source : http://stackoverflow.com/questions/2709315/is-boost-tuple-compatible-with-c0x-variadic-templates
+
+template <std::size_t, typename, typename...> struct nth_arg;
+
+template <std::size_t N, typename Void, typename T, typename... Args>
+struct nth_arg<N, Void, T, Args...>
+{
+ typedef typename nth_arg<N - 1, Void, Args...>::type type;
+};
+
+template <typename Void, typename T, typename... Args>
+struct nth_arg<0, Void, T, Args...>
+{
+ typedef T type;
+};
+
+template <std::size_t N, typename Void>
+struct nth_arg<N, Void>
+{
+ typedef Void type;
+};
+
+}// variadic_sequence_aux
+}// detail
+}// mpl
+}// boost
+
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_arg(z, n, data) \
+ typename boost::mpl::detail::variadic_sequence_aux::nth_arg< \
+ n, data, Args...\
+ >::type \
+/**/
+
+#define BOOST_MPL_DETAIL_VARIADIC_SEQUENCE(N, FROM, TO, default_type) \
+template <typename ...Args> \
+struct TO \
+{ \
+ typedef FROM< \
+ BOOST_PP_ENUM( \
+ N, \
+ BOOST_MPL_DETAIL_VARIADIC_SEQUENCE_arg, \
+ default_type \
+ ) \
+ > type; \
+}; \
+/**/
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/temporary/variadic_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/temporary/variadic_vector.hpp 2010-11-29 16:00:58 EST (Mon, 29 Nov 2010)
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////
+// variadic_sequence.hpp //
+// //
+// 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_MPL_DETAIL_VARIADIC_VECTOR_HPP_ER_2010
+#define BOOST_MPL_DETAIL_VARIADIC_VECTOR_HPP_ER_2010
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/aux_/na.hpp>
+#include <boost/assign/v2/temporary/variadic_sequence.hpp>
+
+namespace boost{
+namespace mpl{
+namespace detail{
+
+BOOST_MPL_DETAIL_VARIADIC_SEQUENCE(
+ BOOST_MPL_LIMIT_VECTOR_SIZE,
+ ::boost::mpl::vector,
+ variadic_vector,
+ ::boost::mpl::na
+)
+
+}// detail
+}// mpl
+}// boost
+
+#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