|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63532 - in sandbox/SOC/2009/unicode: boost/iterator boost/range boost/unicode libs/unicode/test libs/unicode/test/iterator libs/unicode/test/unicode
From: loufoque_at_[hidden]
Date: 2010-07-02 17:02:36
Author: mgaunard
Date: 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
New Revision: 63532
URL: http://svn.boost.org/trac/boost/changeset/63532
Log:
removing boost.range subset and home-made join_iterator
Removed:
sandbox/SOC/2009/unicode/boost/iterator/join_iterator.hpp
sandbox/SOC/2009/unicode/boost/range/
sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_join.cpp
Text files modified:
sandbox/SOC/2009/unicode/boost/unicode/cat.hpp | 50 ++++++++++++++++++---------------------
sandbox/SOC/2009/unicode/boost/unicode/combining.hpp | 4 ++
sandbox/SOC/2009/unicode/boost/unicode/compose_fwd.hpp | 2
sandbox/SOC/2009/unicode/libs/unicode/test/Jamfile.v2 | 3 -
sandbox/SOC/2009/unicode/libs/unicode/test/unicode/range_test.hpp | 2
5 files changed, 29 insertions(+), 32 deletions(-)
Deleted: sandbox/SOC/2009/unicode/boost/iterator/join_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/join_iterator.hpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
+++ (empty file)
@@ -1,407 +0,0 @@
-#ifndef BOOST_ITERATOR_JOIN_ITERATOR_HPP
-#define BOOST_ITERATOR_JOIN_ITERATOR_HPP
-
-#include <boost/iterator/iterator_facade.hpp>
-#include <boost/range.hpp>
-
-#include <boost/mpl/front.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/push_back.hpp>
-#include <boost/mpl/transform_view.hpp>
-
-#include <boost/fusion/include/mpl.hpp>
-#include <boost/fusion/tuple.hpp>
-#include <boost/fusion/adapted.hpp>
-#include <boost/fusion/container/vector/convert.hpp>
-#include <boost/fusion/include/as_vector.hpp>
-
-#include <boost/fusion/algorithm/transformation/transform.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/functional/adapter/unfused.hpp>
-
-#include <boost/functional/forward_adapter.hpp>
-
-#include <boost/variant.hpp>
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/utility/common_type.hpp>
-
-/* This file defines an iterator adapter to make a tuple of ranges appear
- * as a single concatenated range */
-
-namespace boost
-{
-
-namespace detail
-{
- /* Each iterator of the tuple must have a unique type to identify it
- * in a variant, so it is wrapped */
- template<typename T, int N>
- struct wrapper : iterator_facade<
- wrapper<T, N>,
- typename std::iterator_traits<T>::value_type,
- typename std::iterator_traits<T>::iterator_category,
- typename std::iterator_traits<T>::reference,
- typename std::iterator_traits<T>::difference_type
- >
- {
- static const int index = N;
-
- wrapper() {} // singular
-
- wrapper(const T& t_) : t(t_)
- {
- }
-
- private:
- friend class boost::iterator_core_access;
-
- typename std::iterator_traits<T>::reference
- dereference() const { return *t; }
-
- void increment() { ++t; }
- void decrement() { --t; }
- void advance(typename std::iterator_traits<T>::difference_type n) { t += n; }
-
- typename std::iterator_traits<T>::difference_type
- distance_to(const wrapper& other) const { other.t - t; }
-
- template<typename U, int M>
- typename std::iterator_traits<T>::difference_type
- distance_to(const wrapper<U, M>& other) const { other.t - t; }
-
- template<typename U>
- typename std::iterator_traits<T>::difference_type
- distance_to(const U& other) const { other - t; }
-
- bool equal(const wrapper& other) const { return t == other.t; }
-
- template<typename U, int M>
- bool equal(const wrapper<U, M>& other) const { return t == other.t; }
-
- template<typename U>
- bool equal(const U& other) const { return t == other; }
-
- T t;
- };
-
- template<typename F, typename N>
- struct meta_wrapper
- {
- typedef wrapper<F, N::value> type;
- };
-
- template<int N, typename T>
- wrapper<T, N> make_wrapper(const T& t)
- {
- return wrapper<T, N>(t);
- }
-
- /* We need to deduce what is the best type to hold any value out of
- * the potentially slightly heterogeneous types in the tuple, and
- * do that for value_type, reference and difference_type. */
-
- template<typename RangeSequence>
- struct deduce_value_type : common_type_seq<
- mpl::transform_view<
- RangeSequence,
- range_value<mpl::_1>
- >
- >
- {
- };
-
- template<typename Iterator>
- struct reference_type
- {
- typedef typename std::iterator_traits<Iterator>::reference type;
- };
-
- template<typename RangeSequence>
- struct deduce_reference : common_type_seq<
- mpl::transform_view<
- RangeSequence,
- reference_type<
- range_iterator<mpl::_1>
- >
- >
- >
- {
- };
-
- template<typename Iterator>
- struct difference_type
- {
- typedef typename std::iterator_traits<Iterator>::difference_type type;
- };
-
- template<typename RangeSequence>
- struct deduce_difference_type : common_type_seq<
- mpl::transform_view<
- RangeSequence,
- difference_type<
- range_iterator<mpl::_1>
- >
- >
- >
- {
- };
-
- template<typename R>
- struct dereference_visitor : static_visitor<R>
- {
- template<typename T>
- R operator()(const T& t) const
- {
- return *t;
- }
- };
-
- template<typename Tuple, typename Variant>
- struct increment_visitor : static_visitor<Variant>
- {
- increment_visitor(Tuple& tuple_) : tuple(tuple_) {}
-
- template<typename T>
- typename enable_if_c<
- T::index+1 == mpl::size<Tuple>::type::value,
- Variant
- >::type operator()(T& t) const
- {
- return ++t;
- }
-
- template<typename T>
- typename disable_if_c<
- T::index+1 == mpl::size<Tuple>::type::value,
- Variant
- >::type operator()(T& t) const
- {
- if(++t == make_wrapper<T::index>(boost::end(fusion::get<T::index>(tuple))))
- return make_wrapper<T::index+1>(
- boost::begin(
- fusion::get<T::index+1>(tuple)
- )
- );
- return t;
- }
-
- Tuple& tuple;
- };
-
- template<typename Tuple, typename Variant>
- struct decrement_visitor : static_visitor<Variant>
- {
- decrement_visitor(Tuple& tuple_) : tuple(tuple_) {}
-
- template<typename T>
- typename enable_if_c<
- T::index == 0,
- Variant
- >::type
- operator()(T& t) const
- {
- return --t;
- }
-
- template<typename T>
- typename disable_if_c<
- T::index == 0,
- Variant
- >::type
- operator()(T& t) const
- {
- if(t == make_wrapper<T::index>(boost::begin(fusion::get<T::index>(tuple))))
- return make_wrapper<T::index-1>(
- boost::prior(
- boost::end(
- fusion::get<T::index-1>(tuple)
- )
- )
- );
- return --t;
- }
-
- Tuple& tuple;
- };
-
- struct equal_visitor : static_visitor<bool>
- {
- template<typename T1, typename T2>
- bool operator()(const T1&, const T2&) const
- {
- return false;
- }
-
- template<typename T>
- bool operator()(const T& lft, const T& rgt) const
- {
- return lft == rgt;
- }
- };
-
-} // namespace detail
-
-template<typename Tuple>
-struct join_iterator;
-
-template<typename Tuple>
-join_iterator<Tuple> make_join_end_iterator(const Tuple& tuple);
-
-/** Iterator that wraps a tuple of ranges and makes it appear as
- * a single concatenated range. */
-template<typename Tuple>
-struct join_iterator
- : iterator_facade<
- join_iterator<Tuple>,
- typename detail::deduce_value_type<typename fusion::result_of::as_vector<Tuple>::type>::type,
- std::bidirectional_iterator_tag,
- typename detail::deduce_reference<typename fusion::result_of::as_vector<Tuple>::type>::type,
- typename detail::deduce_difference_type<typename fusion::result_of::as_vector<Tuple>::type>::type
- >
-{
- join_iterator() {} // singular
-
- join_iterator(const Tuple& t_) : t(t_), v(detail::make_wrapper<0>(boost::begin(fusion::get<0>(t))))
- {
- }
-
-private:
- join_iterator(const Tuple& t_, bool) : t(t_), v(detail::make_wrapper<mpl::size<FusionTuple>::value-1>(boost::end(fusion::get<mpl::size<FusionTuple>::value-1>(t))))
- {
- }
-
- friend join_iterator<Tuple> make_join_end_iterator<Tuple>(const Tuple& tuple);
- friend class boost::iterator_core_access;
- typedef typename fusion::result_of::as_vector<Tuple>::type FusionTuple;
- typedef typename detail::deduce_reference<FusionTuple>::type Reference;
-
- Reference dereference() const
- {
- return apply_visitor(
- detail::dereference_visitor<Reference>(),
- v
- );
- }
-
- void increment()
- {
- v = apply_visitor(detail::increment_visitor<FusionTuple, Variant>(t), v);
- }
-
- void decrement()
- {
- v = apply_visitor(detail::decrement_visitor<FusionTuple, Variant>(t), v);
- }
-
- bool equal(const join_iterator& other) const
- {
- return apply_visitor(detail::equal_visitor(), v, other.v);
- }
-
- FusionTuple t;
- typedef typename make_variant_over<
- typename mpl::fold<
- FusionTuple,
- mpl::vector<>,
- mpl::push_back<
- mpl::_1,
- mpl::quote2<detail::meta_wrapper>::apply<
- range_iterator<mpl::_2>,
- mpl::size<mpl::_1>
- >
- >
- >::type
- >::type Variant;
- Variant v;
-};
-
-template<typename Tuple>
-join_iterator<Tuple> make_join_iterator(const Tuple& tuple)
-{
- return join_iterator<Tuple>(tuple);
-}
-
-template<typename Tuple>
-join_iterator<Tuple> make_join_end_iterator(const Tuple& tuple)
-{
- return join_iterator<Tuple>(tuple, true);
-}
-
-template<typename Tuple>
-iterator_range<
- join_iterator<Tuple>
-> joined(const Tuple& tuple)
-{
- return make_iterator_range(
- make_join_iterator(tuple),
- make_join_end_iterator(tuple)
- );
-}
-
-/* We convert ranges to iterator_range to avoid copying containers */
-namespace detail
-{
- struct range_tuple_transformer
- {
- template<typename>
- struct result {};
-
- template<typename F, typename R>
- struct result<F(R&)>
- {
- typedef iterator_range<
- typename range_iterator<R>::type
- > type;
- };
-
- template<typename Range>
- typename result<range_tuple_transformer(Range&)>::type
- operator()(Range& r) const
- {
- return make_iterator_range(r);
- }
- };
-
- struct fused_make_range_tuple
- {
- template<typename>
- struct result
- {
- };
-
- template<typename F, typename Seq>
- struct result<F(Seq&)>
- {
- typedef iterator_range< join_iterator<
- typename fusion::result_of::transform<
- Seq const,
- range_tuple_transformer
- >::type > > type;
- };
-
- template<class Seq>
- typename result<fused_make_range_tuple(Seq&)>::type operator()(Seq const & s) const
- {
- return joined(fusion::transform(s, range_tuple_transformer()));
- }
- };
-}
-
-/* Perfect forwarding with fusion::unfused + forward_adapter */
-#ifndef BOOST_UNICODE_DOXYGEN_INVOKED
-forward_adapter<
- fusion::unfused<detail::fused_make_range_tuple>
-> joined_n;
-#else
-template<typename... T>
-join_iterator<
- fusion::vector< sub_range<T>... >
-> joined_n(T&&... ranges);
-#endif
-
-} // namespace boost
-
-#endif
Modified: sandbox/SOC/2009/unicode/boost/unicode/cat.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/cat.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/unicode/cat.hpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
@@ -8,7 +8,7 @@
#include <algorithm>
#include <boost/utility.hpp>
-#include <boost/iterator/join_iterator.hpp>
+#include <boost/range/join.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/tuple/tuple.hpp>
@@ -120,7 +120,7 @@
t = cat_limits(range1, range2); \
\
out = copy(t.get<0>(), out); \
- out = pipe(joined_n(t.get<1>(), t.get<2>()), make_piped_pipe(utf_decoder(), BOOST_PP_SEQ_ELEM(1, seq)(BOOST_PP_ENUM_PARAMS(n, t))), utf_encoded_out<typename range_value<const Range1>::type>(out)).base(); \
+ out = pipe(boost::join(t.get<1>(), t.get<2>()), make_piped_pipe(utf_decoder(), BOOST_PP_SEQ_ELEM(1, seq)(BOOST_PP_ENUM_PARAMS(n, t))), utf_encoded_out<typename range_value<const Range1>::type>(out)).base(); \
return copy(t.get<3>(), out); \
}
@@ -142,29 +142,25 @@
/** INTERNAL ONLY */
#define BOOST_UNICODE_COMPOSE_CONCATED_DEF_A(z, n, seq) \
template<typename Range1, typename Range2 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename T)> \
-iterator_range< \
- join_iterator< \
- tuple< \
- iterator_range<typename range_iterator<const Range1>::type>, \
- iterator_range< \
- pipe_iterator< \
- join_iterator< \
- tuple< \
- iterator_range<typename range_iterator<const Range1>::type>, \
- iterator_range<typename range_iterator<const Range2>::type> \
- > \
- >, \
- piped_pipe< \
- utf_decoder, \
- multi_pipe< \
- BOOST_PP_SEQ_ELEM(1, seq), \
- utf_encoder<typename range_value<const Range1>::type> \
- > \
+joined_range< \
+ sub_range<const Range1>, \
+ joined_range< \
+ iterator_range< \
+ pipe_iterator< \
+ joined_range< \
+ sub_range<const Range1>, \
+ sub_range<const Range2> \
+ >, \
+ piped_pipe< \
+ utf_decoder, \
+ multi_pipe< \
+ BOOST_PP_SEQ_ELEM(1, seq), \
+ utf_encoder<typename range_value<const Range1>::type> \
> \
> \
- >, \
- iterator_range<typename range_iterator<const Range2>::type> \
- > \
+ > \
+ >, \
+ sub_range<const Range2> \
> \
> BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, seq), _concated)(const Range1& range1, const Range2& range2 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_BINARY_PARAMS(n, const T, & t)) \
{ \
@@ -176,10 +172,10 @@
> \
t = cat_limits(range1, range2); \
\
- return joined_n( \
+ return boost::join( \
t.get<0>(), \
- piped( \
- joined_n(t.get<1>(), t.get<2>()), \
+ boost::join(piped( \
+ boost::join(t.get<1>(), t.get<2>()), \
make_piped_pipe( \
utf_decoder(), \
make_multi_pipe( \
@@ -189,7 +185,7 @@
) \
), \
t.get<3>() \
- ); \
+ )); \
}
/** INTERNAL ONLY */
Modified: sandbox/SOC/2009/unicode/boost/unicode/combining.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/combining.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/unicode/combining.hpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
@@ -6,6 +6,8 @@
#include <boost/cuchar.hpp>
#include <algorithm>
+#include <boost/range/adaptor/reversed.hpp>
+
#include <boost/throw_exception.hpp>
#include <stdexcept>
#ifndef BOOST_NO_STD_LOCALE
@@ -124,7 +126,7 @@
reverse_iterator<In>,
Out
> p = combine_sort_impl(
- make_reversed_range(
+ boost::adaptors::reverse(
*boost::prior(
make_consumer_iterator(begin, end, end, combiner())
)
Modified: sandbox/SOC/2009/unicode/boost/unicode/compose_fwd.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/compose_fwd.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/unicode/compose_fwd.hpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
@@ -65,7 +65,7 @@
reverse_iterator<In>,
Out
> p = decompose_impl(
- make_reversed_range(
+ boost::adaptors::reverse(
*boost::prior(
make_consumer_iterator(begin, end, end, combiner())
)
Modified: sandbox/SOC/2009/unicode/libs/unicode/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/test/Jamfile.v2 (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/test/Jamfile.v2 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
@@ -16,13 +16,12 @@
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>gcc:<cxxflags>-Wno-multichar
<library>../build//boost_unicode/
- <link>shared:<define>BOOST_UNICODE_DYN_LINK=1
+ <link>shared:<define>BOOST_UNICODE_DYN_LINK=1
;
test-suite iterator :
[ run iterator/test_pipe.cpp ]
[ run iterator/test_consumer.cpp ]
- [ run iterator/test_join.cpp ]
;
test-suite unicode :
Deleted: sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_join.cpp
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_join.cpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
+++ (empty file)
@@ -1,43 +0,0 @@
-#define BOOST_TEST_MODULE Join
-#include <boost/test/included/unit_test.hpp>
-#include <boost/test/test_case_template.hpp>
-#include <boost/mpl/list.hpp>
-
-#include <boost/iterator/join_iterator.hpp>
-#include <boost/range/as_array.hpp>
-
-#include "../unicode/range_test.hpp"
-
-BOOST_AUTO_TEST_CASE ( join )
-{
- int one[] = {1, 2, 3, 4};
- std::vector<int> two;
- two.push_back(5); two.push_back(6);
- std::list<int> three;
- three.push_back(7); three.push_back(8); three.push_back(9);
- int four = 10;
-
- int sum[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-
- CHECK_BI_EQUALS(
- boost::joined_n(
- boost::as_array(one),
- two,
- three,
- boost::make_iterator_range(&four, &four + 1)
- ),
- sum
- );
-}
-
-typedef boost::mpl::list<
- int*,
- const int*,
- std::vector<int>::iterator,
- std::list<int>::iterator,
- std::istream_iterator<char, char>
-> instantiate_types;
-
-BOOST_AUTO_TEST_CASE_TEMPLATE( instantiate, T, instantiate_types )
-{
-}
Modified: sandbox/SOC/2009/unicode/libs/unicode/test/unicode/range_test.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/test/unicode/range_test.hpp (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/test/unicode/range_test.hpp 2010-07-02 17:02:35 EDT (Fri, 02 Jul 2010)
@@ -41,7 +41,7 @@
>
reversed(const Range& range)
{
- return boost::make_reversed_range(range);
+ return boost::adaptors::reverse(range);
}
} // namespace detail
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