|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64141 - in sandbox/SOC/2009/unicode: boost/iterator boost/unicode libs/unicode/doc libs/unicode/doc/concepts libs/unicode/test/iterator
From: loufoque_at_[hidden]
Date: 2010-07-18 13:26:26
Author: mgaunard
Date: 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
New Revision: 64141
URL: http://svn.boost.org/trac/boost/changeset/64141
Log:
changing the Converter and Segmenter concepts to take their input by reference and modify it
Text files modified:
sandbox/SOC/2009/unicode/boost/iterator/convert_iterator.hpp | 106 +++++++++++------------------
sandbox/SOC/2009/unicode/boost/iterator/convert_iterator_fwd.hpp | 17 +---
sandbox/SOC/2009/unicode/boost/iterator/converter_codecvt_facet.hpp | 15 +---
sandbox/SOC/2009/unicode/boost/iterator/converter_concept.hpp | 5
sandbox/SOC/2009/unicode/boost/iterator/segment_iterator.hpp | 55 +++++++-------
sandbox/SOC/2009/unicode/boost/iterator/segment_iterator_fwd.hpp | 10 +-
sandbox/SOC/2009/unicode/boost/iterator/segmenter_concept.hpp | 4
sandbox/SOC/2009/unicode/boost/unicode/cat.hpp | 28 +++++--
sandbox/SOC/2009/unicode/boost/unicode/combining.hpp | 50 +++++++------
sandbox/SOC/2009/unicode/boost/unicode/compose_fwd.hpp | 49 +++++++------
sandbox/SOC/2009/unicode/boost/unicode/hangul.hpp | 22 +++---
sandbox/SOC/2009/unicode/boost/unicode/utf_codecs.hpp | 141 +++++++++++++++++++--------------------
sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Converter.xml | 32 +++++---
sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Segmenter.xml | 28 ++++---
sandbox/SOC/2009/unicode/libs/unicode/doc/users_manual.qbk | 46 +++++-------
sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_convert.cpp | 8 +-
sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_segment.cpp | 6 -
17 files changed, 303 insertions(+), 319 deletions(-)
Modified: sandbox/SOC/2009/unicode/boost/iterator/convert_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/convert_iterator.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/convert_iterator.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -2,12 +2,10 @@
#define BOOST_ITERATOR_PIPE_ITERATOR_HPP
#include <boost/assert.hpp>
-#include <utility>
#include <boost/range.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/times.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/concept/requires.hpp>
#include <boost/range/concepts.hpp>
@@ -29,23 +27,21 @@
struct one_many_converter
{
template<typename In, typename Out>
- std::pair<In, Out>
- ltr(In begin, In end, Out out)
+ Out
+ ltr(In& begin, In end, Out out)
{
BOOST_ASSERT(begin != end);
- out = static_cast<OneManyConverter&>(*this)(*begin, out);
- return std::make_pair(++begin, out);
+ return static_cast<OneManyConverter&>(*this)(*begin++, out);
}
template<typename In, typename Out>
- std::pair<In, Out>
- rtl(In begin, In end, Out out)
+ Out
+ rtl(In begin, In& end, Out out)
{
BOOST_ASSERT(begin != end);
- out = static_cast<OneManyConverter&>(*this)(*--end, out);
- return std::make_pair(end, out);
+ return static_cast<OneManyConverter&>(*this)(*--end, out);
}
};
@@ -87,22 +83,20 @@
typename P2::output_type
>
>,
- std::pair<In, Out>
+ Out
>::type
- ltr(In begin, In end, Out out)
+ ltr(In& begin, In end, Out out)
{
Out b = out;
-
- std::pair<In, Out> pair = p1.ltr(begin, end, out);
- Out e = pair.second;
+ Out e = p1.ltr(begin, end, out);
do
{
- tie(b, out) = p2.ltr(b, e, out);
+ out = p2.ltr(b, e, out);
}
while(b != e);
- return std::make_pair(pair.first, out);
+ return out;
}
template<typename In, typename Out>
@@ -117,23 +111,21 @@
typename P2::output_type
>
>,
- std::pair<In, Out>
+ Out
>::type
- ltr(In begin, In end, Out out)
+ ltr(In& begin, In end, Out out)
{
typename P1::output_type buf[max_output::value];
typename P1::output_type* b = buf;
-
- std::pair<In, typename P1::output_type*> pair = p1.ltr(begin, end, buf);
- typename P1::output_type* e = pair.second;
+ typename P1::output_type* e = p1.ltr(begin, end, buf);
do
{
- tie(b, out) = p2.ltr(b, e, out);
+ out = p2.ltr(b, e, out);
}
while(b != e);
- return std::make_pair(pair.first, out);
+ return out;
}
template<typename In, typename Out>
@@ -148,21 +140,19 @@
typename P2::output_type
>
>,
- std::pair<In, Out>
- >::type rtl(In begin, In end, Out out)
+ Out
+ >::type rtl(In begin, In& end, Out out)
{
- Out b = out;
-
- std::pair<In, Out> pair = p1.rtl(begin, end, out);
- Out e = pair.second;
+ Out b = out;
+ Out e = p1.rtl(begin, end, out);
do
{
- tie(b, out) = p2.ltr(b, e, out);
+ out = p2.ltr(b, e, out);
}
while(b != e);
- return std::make_pair(pair.first, out);
+ return out;
}
template<typename In, typename Out>
@@ -177,22 +167,20 @@
typename P2::output_type
>
>,
- std::pair<In, Out>
- >::type rtl(In begin, In end, Out out)
+ Out
+ >::type rtl(In begin, In& end, Out out)
{
typename P1::output_type buf[max_output::value];
typename P1::output_type* b = buf;
-
- std::pair<In, typename P1::output_type*> pair = p1.rtl(begin, end, buf);
- typename P1::output_type* e = pair.second;
+ typename P1::output_type* e = p1.rtl(begin, end, buf);
do
{
- tie(b, out) = p2.ltr(b, e, out);
+ out = p2.ltr(b, e, out);
}
while(b != e);
- return std::make_pair(pair.first, out);
+ return out;
}
private:
@@ -231,32 +219,25 @@
converted_converter(P1 p1_, P2 p2_ = P2()) : P2(p2_), p1(p1_) {}
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
- std::pair<
- convert_iterator<In, P1>,
- Out
- > pair = P2::ltr(
- make_convert_iterator(begin, end, begin, p1),
- make_convert_iterator(begin, end, end, p1),
- out
- );
+ convert_iterator<In, P1> b = make_convert_iterator(begin, end, begin, p1);
+ convert_iterator<In, P1> e = make_convert_iterator(begin, end, end, p1);
- return std::make_pair(pair.first.base(), pair.second);
+ out = P2::ltr(b, e, out);
+ begin = b.base();
+ return out;
}
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
- std::pair<
- convert_iterator<In, P1>,
- Out
- > pair = P2::rtl(
- make_convert_iterator(begin, end, begin, p1),
- make_convert_iterator(begin, end, end, p1),
- out
- );
- return std::make_pair(pair.first.base(), pair.second);
+ convert_iterator<In, P1> b = make_convert_iterator(begin, end, begin, p1);
+ convert_iterator<In, P1> e = make_convert_iterator(begin, end, end, p1);
+
+ out = P2::rtl(b, e, out);
+ end = b.base();
+ return out;
}
private:
@@ -304,6 +285,7 @@
return convert_iterator<It, Converter>(begin, end, pos, p);
}
+/** Range wrapper around \c boost::convert_iterator */
template<typename Range, typename Converter>
struct converted_range : boost::iterator_range<
boost::convert_iterator<
@@ -337,11 +319,7 @@
Iterator end = boost::end(range);
while(begin != end)
- {
- std::pair<Iterator, OutputIterator> p = convert.ltr(begin, end, out);
- begin = p.first;
- out = p.second;
- }
+ out = convert.ltr(begin, end, out);
return out;
}
Modified: sandbox/SOC/2009/unicode/boost/iterator/convert_iterator_fwd.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/convert_iterator_fwd.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/convert_iterator_fwd.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -31,10 +31,8 @@
{
if(pos != end)
{
- std::pair<It, typename detail::convert_output_storage<Converter>::output_iterator> pair =
- p.ltr(pos, end, values.out());
- next_pos = pair.first;
- values.update(pair.second);
+ next_pos = pos;
+ values.update(p.ltr(next_pos, end, values.out()));
}
}
@@ -65,10 +63,7 @@
pos = next_pos;
if(pos != end)
{
- std::pair<It, typename detail::convert_output_storage<Converter>::output_iterator> pair =
- p.ltr(pos, end, values.out());
- next_pos = pair.first;
- values.update(pair.second);
+ values.update(p.ltr(next_pos, end, values.out()));
}
index = 0;
}
@@ -85,11 +80,7 @@
else
{
next_pos = pos;
-
- std::pair<It, typename detail::convert_output_storage<Converter>::output_iterator> pair =
- p.rtl(begin, pos, values.out());
- pos = pair.first;
- values.update(pair.second);
+ values.update(p.rtl(begin, pos, values.out()));
index = values.last_index();
}
Modified: sandbox/SOC/2009/unicode/boost/iterator/converter_codecvt_facet.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/converter_codecvt_facet.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/converter_codecvt_facet.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -72,10 +72,8 @@
try
{
- std::pair<const extern_type*, intern_type*> p = p2.ltr(from_next, from_end, st.pending_data);
- from_next = p.first;
+ st.pending_size = p2.ltr(from_next, from_end, st.pending_data) - st.pending_data;
*to_next++ = st.pending_data[0];
- st.pending_size = p.second - st.pending_data;
std::copy(st.pending_data + 1, st.pending_data + st.pending_size, st.pending_data);
st.pending_size--;
}
@@ -117,9 +115,7 @@
{
try
{
- std::pair<iterator, extern_type*> p = p1.ltr(from_next2, from_end2, to_next);
- from_next2 = p.first;
- to_next = p.second;
+ to_next = p1.ltr(from_next2, from_end2, to_next);
}
catch(...)
{
@@ -169,9 +165,7 @@
{
try
{
- std::pair<const intern_type*, extern_type*> p = p1.ltr(from_next, from_end, to_next);
- from_next = p.first;
- to_next = p.second;
+ to_next = p1.ltr(from_next, from_end, to_next);
}
catch(...)
{
@@ -200,8 +194,7 @@
{
try
{
- std::pair<const extern_type*, dummy_output_iterator> p = p2.ltr(from_next, from_end, dummy_output_iterator());
- from_next = p.first;
+ p2.ltr(from_next, from_end, dummy_output_iterator());
}
catch(...)
{
Modified: sandbox/SOC/2009/unicode/boost/iterator/converter_concept.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/converter_concept.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/converter_concept.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -19,8 +19,8 @@
BOOST_CONCEPT_USAGE(ConverterConcept)
{
X convert;
- p = convert.ltr(begin, end, out);
- p = convert.rtl(begin, end, out);
+ out = convert.ltr(begin, end, out);
+ out = convert.rtl(begin, end, out);
}
private:
@@ -30,7 +30,6 @@
in_type begin;
in_type end;
out_type out;
- std::pair<in_type, out_type> p;
};
/** Concept checking class for the \c \xmlonly<conceptname>OneManyConverter</conceptname>\endxmlonly concept */
Modified: sandbox/SOC/2009/unicode/boost/iterator/segment_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/segment_iterator.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/segment_iterator.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -5,7 +5,7 @@
#include <boost/concept/requires.hpp>
#include <boost/range/concepts.hpp>
-#include <boost/iterator/converter_concept.hpp>
+#include <boost/iterator/convert_iterator.hpp>
#include <boost/iterator/segment_iterator_fwd.hpp>
@@ -33,15 +33,15 @@
}
template<typename In>
- In ltr(In begin, In end)
+ void ltr(In& begin, In end)
{
- return Converter::ltr(begin, end, dummy_output_iterator()).first;
+ Converter::ltr(begin, end, dummy_output_iterator());
}
template<typename In>
- In rtl(In begin, In end)
+ void rtl(In begin, In& end)
{
- return Converter::rtl(begin, end, dummy_output_iterator()).first;
+ Converter::rtl(begin, end, dummy_output_iterator());
}
};
@@ -71,25 +71,21 @@
}
template<typename In>
- In ltr(In begin, In end)
+ void ltr(In& begin, In end)
{
- In pos = begin;
+ In b = begin;
do
- ++pos;
- while(pos != end && !BoundaryChecker::operator()(begin, end, pos));
-
- return pos;
+ ++begin;
+ while(begin != end && !BoundaryChecker::operator()(b, end, begin));
}
template<typename In>
- In rtl(In begin, In end)
+ void rtl(In begin, In& end)
{
- In pos = end;
+ In e = end;
do
- --pos;
- while(pos != end && !BoundaryChecker::operator()(begin, end, pos));
-
- return pos;
+ --end;
+ while(end != begin && !BoundaryChecker::operator()(begin, e, end));
}
};
@@ -178,21 +174,23 @@
}
template<typename In>
- In ltr(In begin, In end)
+ void ltr(In& begin, In end)
{
- return c.ltr(
- make_convert_iterator(begin, end, begin, p),
- make_convert_iterator(begin, end, end, p)
- ).base();
+ convert_iterator<In, Converter> b = make_convert_iterator(begin, end, begin, p);
+ convert_iterator<In, Converter> e = make_convert_iterator(begin, end, end, p);
+
+ c.ltr(b, e);
+ begin = b.base();
}
template<typename In>
- In rtl(In begin, In end)
+ void rtl(In begin, In& end)
{
- return c.rtl(
- make_convert_iterator(begin, end, begin, p),
- make_convert_iterator(begin, end, end, p)
- ).base();
+ convert_iterator<In, Converter> b = make_convert_iterator(begin, end, begin, p);
+ convert_iterator<In, Converter> e = make_convert_iterator(begin, end, end, p);
+
+ c.rtl(b, e);
+ end = e.base();
}
private:
@@ -222,6 +220,7 @@
return segment_iterator<It, Segmenter>(begin, end, pos, c);
}
+/** Range wrapper around \c boost::segment_iterator */
template<typename Range, typename Segmenter>
struct segmented_range : boost::iterator_range<
boost::segment_iterator<
@@ -230,11 +229,13 @@
>
>
{
+private:
typedef boost::segment_iterator<
typename boost::range_iterator<Range>::type,
Segmenter
> Iterator;
+public:
segmented_range(Iterator begin, Iterator end) : boost::iterator_range<Iterator>(begin, end)
{
}
Modified: sandbox/SOC/2009/unicode/boost/iterator/segment_iterator_fwd.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/segment_iterator_fwd.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/segment_iterator_fwd.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -29,7 +29,10 @@
segment_iterator(It begin_, It end_, It pos_, Segmenter c_) : pos(pos_), begin(begin_), end(end_), p(c_)
{
if(pos != end)
- next_pos = p.ltr(pos, end);
+ {
+ next_pos = pos;
+ p.ltr(next_pos, end);
+ }
}
It base() const
@@ -51,7 +54,7 @@
{
pos = next_pos;
if(pos != end)
- next_pos = p.ltr(pos, end);
+ p.ltr(next_pos, end);
}
void decrement()
@@ -59,8 +62,7 @@
BOOST_CONCEPT_ASSERT((BidirectionalIterator<It>));
next_pos = pos;
-
- pos = p.rtl(begin, pos);
+ p.rtl(begin, pos);
}
bool equal(const segment_iterator& other) const
Modified: sandbox/SOC/2009/unicode/boost/iterator/segmenter_concept.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/iterator/segmenter_concept.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/iterator/segmenter_concept.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -16,8 +16,8 @@
BOOST_CONCEPT_USAGE(SegmenterConcept)
{
X c;
- begin = c.ltr(begin, end);
- end = c.rtl(begin, end);
+ c.ltr(begin, end);
+ c.rtl(begin, end);
}
private:
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-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -64,17 +64,29 @@
utf_decoder \
> decoded1 = adaptors::utf_decode(range1); \
\
- typename range_iterator<cv1 Range1>::type \
- new_end = combiner().rtl( \
+ convert_iterator< \
+ typename range_iterator<cv1 Range1>::type, \
+ utf_decoder \
+ > end = boost::end(decoded1); \
+ \
+ convert_iterator< \
+ typename range_iterator<cv2 Range2>::type, \
+ utf_decoder \
+ > begin = boost::begin(decoded2); \
+ \
+ combiner().rtl( \
boost::begin(decoded1), \
- boost::end(decoded1) \
- ).base(); \
+ end \
+ ); \
+ typename range_iterator<cv1 Range1>::type \
+ new_end = end.base(); \
\
- typename range_iterator<cv2 Range2>::type \
- new_begin = combiner().ltr( \
- boost::begin(decoded2), \
+ combiner().ltr( \
+ begin, \
boost::end(decoded2) \
- ).base(); \
+ ); \
+ typename range_iterator<cv2 Range2>::type \
+ new_begin = begin.base(); \
\
return make_tuple( \
make_iterator_range(boost::begin(range1), new_end), \
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-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -50,11 +50,14 @@
template<typename Iterator>
void not_stream_safe(Iterator begin, Iterator end)
{
+ typedef typename std::iterator_traits<Iterator>::value_type ValueType;
+ typedef typename boost::make_unsigned<ValueType>::type UnsignedType;
+
#ifndef BOOST_NO_STD_LOCALE
std::stringstream ss;
ss << "Invalid Unicode stream-safe combining character sequence " << std::showbase << std::hex;
for(Iterator it = begin; it != end; ++it)
- ss << *it << " ";
+ ss << (boost::uint_least32_t)(UnsignedType)*it << " ";
ss << "encountered while trying to decompose UTF-32 sequence";
std::out_of_range e(ss.str());
#else
@@ -86,21 +89,19 @@
typedef char32 output_type;
template<typename Iterator>
- Iterator ltr(Iterator begin, Iterator end)
+ void ltr(Iterator& begin, Iterator end)
{
do
{
++begin;
}
while(begin != end && ucd::get_combining_class(*begin) != 0);
- return begin;
}
template<typename Iterator>
- Iterator rtl(Iterator begin, Iterator end)
+ void rtl(Iterator begin, Iterator& end)
{
while(end != begin && ucd::get_combining_class(*--end) != 0);
- return end;
}
};
@@ -111,37 +112,38 @@
typedef combining_max max_output;
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
- return combine_sort_impl(
- *make_segment_iterator(begin, end, begin, combiner()),
- out
- );
+ boost::iterator_range<
+ In
+ > sequence = *boost::make_segment_iterator(begin, end, begin, combiner());
+
+ out = combine_sort_impl(sequence, out);
+ begin = boost::end(sequence);
+ return out;
}
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
- std::pair<
- reverse_iterator<In>,
- Out
- > p = combine_sort_impl(
- boost::adaptors::reverse(
- *boost::prior(
- make_segment_iterator(begin, end, end, combiner())
- )
- ),
- out
+ boost::reverse_range<
+ const boost::iterator_range<In>
+ > sequence = boost::adaptors::reverse(
+ *boost::prior(
+ boost::make_segment_iterator(begin, end, end, combiner())
+ )
);
- return std::make_pair(p.first.base(), p.second);
+ out = combine_sort_impl(sequence, out);
+ end = boost::end(sequence).base();
+ return out;
}
private:
template<typename Range, typename Out>
- std::pair<typename range_iterator<const Range>::type, Out> combine_sort_impl(const Range& range, Out out)
+ Out combine_sort_impl(const Range& range, Out out)
{
- return std::make_pair(boost::end(range), combine_sort_impl(boost::begin(range), boost::end(range), out));
+ return combine_sort_impl(boost::begin(range), boost::end(range), out);
}
template<typename In, typename Out>
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-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -48,39 +48,40 @@
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not stream-safe.
* \post \c out is in Normalization Form D and is stream-safe. */
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
- return decompose_impl(
- *make_segment_iterator(begin, end, begin, combiner()),
- out
- );
+ boost::iterator_range<
+ In
+ > sequence = *boost::make_segment_iterator(begin, end, begin, combiner());
+
+ out = decompose_impl(sequence, out);
+ begin = boost::end(sequence);
+ return out;
}
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not stream-safe.
* \post \c out is in Normalization Form D and is stream-safe. */
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
- std::pair<
- reverse_iterator<In>,
- Out
- > p = decompose_impl(
- boost::adaptors::reverse(
- *boost::prior(
- make_segment_iterator(begin, end, end, combiner())
- )
- ),
- out
+ boost::reverse_range<
+ const boost::iterator_range<In>
+ > sequence = boost::adaptors::reverse(
+ *boost::prior(
+ boost::make_segment_iterator(begin, end, end, combiner())
+ )
);
- return std::make_pair(p.first.base(), p.second);
+ out = decompose_impl(sequence, out);
+ end = boost::end(sequence).base();
+ return out;
}
private:
template<typename Range, typename Out>
- std::pair<typename range_iterator<const Range>::type, Out> decompose_impl(const Range& range, Out out)
+ Out decompose_impl(const Range& range, Out out)
{
- return std::make_pair(boost::end(range), decompose_impl(boost::begin(range), boost::end(range), out));
+ return decompose_impl(boost::begin(range), boost::end(range), out);
}
template<typename In, typename Out>
@@ -252,7 +253,7 @@
/** \pre [<tt>begin</tt>, <tt>end</tt>[ is in Normalization Form D.
* \post \c out is in Normalization Form C. */
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
const ucd::unichar_compose_data_entry* table_begin = ucd::__uni_compose_entry;
const ucd::unichar_compose_data_entry* table_end = table_begin + ucd::__uni_compose_entry_size;
@@ -280,7 +281,8 @@
else if( (sz == 1 || pos == end) && offset == (r.begin()->decomp[0]-1)) // a complete match was found
{
*out++ = r.begin()->ch;
- return std::make_pair(pos, out);
+ begin = pos;
+ return out;
}
else if(pos == end) // some possible matches but none complete
{
@@ -297,7 +299,7 @@
/** \pre [<tt>begin</tt>, <tt>end</tt>[ is in Normalization Form D.
* \post \c out is in Normalization Form C. */
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
const ucd::unichar_compose_data_entry* table_begin = ucd::__uni_compose_entry;
const ucd::unichar_compose_data_entry* table_end = table_begin + ucd::__uni_compose_entry_size;
@@ -321,7 +323,8 @@
if(r.size() == 1 && offset == (r.front()->decomp[0]-1))
{
*out++ = r.front()->ch;
- return std::make_pair(pos, out);
+ end = pos;
+ return out;
}
else if(r.size() == 0 || pos == begin)
{
Modified: sandbox/SOC/2009/unicode/boost/unicode/hangul.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/hangul.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/unicode/hangul.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -89,7 +89,7 @@
typedef mpl::int_<1> max_output;
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
char32 ch = *begin++;
@@ -102,7 +102,7 @@
if(begin == end)
{
*out++ = combine_l_v(ch, v);
- return std::make_pair(begin, out);
+ return out;
}
char32 t = *begin;
@@ -110,11 +110,11 @@
{
++begin;
*out++ = combine_lv_t(combine_l_v(ch, v), t);
- return std::make_pair(begin, out);
+ return out;
}
*out++ = combine_l_v(ch, v);
- return std::make_pair(begin, out);
+ return out;
}
}
else if(is_lv(ch) && begin != end)
@@ -124,16 +124,16 @@
{
++begin;
*out++ = combine_lv_t(ch, t);
- return std::make_pair(begin, out);
+ return out;
}
}
*out++ = ch;
- return std::make_pair(begin, out);
+ return out;
}
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
char32 ch = *--end;
@@ -146,14 +146,14 @@
if(is_l(l))
{
*out++ = combine_lv_t(combine_l_v(l, v), ch);
- return std::make_pair(end, out);
+ return out;
}
++end;
}
else if(is_lv(v))
{
*out++ = combine_lv_t(v, ch);
- return std::make_pair(end, out);
+ return out;
}
++end;
}
@@ -163,13 +163,13 @@
if(is_l(l))
{
*out++ = combine_l_v(l, ch);
- return std::make_pair(end, out);
+ return out;
}
++end;
}
*out++ = ch;
- return std::make_pair(end, out);
+ return out;
}
private:
Modified: sandbox/SOC/2009/unicode/boost/unicode/utf_codecs.hpp
==============================================================================
--- sandbox/SOC/2009/unicode/boost/unicode/utf_codecs.hpp (original)
+++ sandbox/SOC/2009/unicode/boost/unicode/utf_codecs.hpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -58,18 +58,21 @@
throw_exception(e);
}
-template<typename Iterator>
+template<int UnitSize, typename Iterator>
inline void invalid_utf_sequence(Iterator begin, Iterator end)
{
+ typedef typename std::iterator_traits<Iterator>::value_type ValueType;
+ typedef typename boost::make_unsigned<ValueType>::type UnsignedType;
+
#ifndef BOOST_NO_STD_LOCALE
std::stringstream ss;
- ss << "Invalid UTF sequence " << std::showbase << std::hex;
+ ss << "Invalid UTF-" << UnitSize << " sequence " << std::showbase << std::hex;
for(Iterator it = begin; it != end; ++it)
- ss << *it << " ";
- ss << "encountered while trying to decode UTF-32 sequence";
+ ss << (boost::uint_least32_t)(UnsignedType)*it << " ";
+ ss << "encountered while trying to convert to UTF-32";
std::out_of_range e(ss.str());
#else
- std::out_of_range e("Invalid UTF sequence encountered while trying to decode UTF-32 sequence");
+ std::out_of_range e("Invalid UTF sequence encountered while trying to convert to UTF-32");
#endif
boost::throw_exception(e);
}
@@ -129,21 +132,20 @@
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not a valid UTF-16 range. */
template<typename In, typename Out>
- std::pair<In, Out>
- ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
BOOST_ASSERT(begin != end);
- In it = begin;
- char32 value = *it;
+ In b = begin;
+ char32 value = *begin;
if(unicode::is_high_surrogate(value))
{
// precondition; next value must be a low-surrogate:
- if(++it == end)
- detail::invalid_utf_sequence(begin, end);
+ if(++begin == end)
+ detail::invalid_utf_sequence<16>(b, end);
- char16 lo = *it;
+ char16 lo = *begin;
if(!unicode::is_low_surrogate(lo))
detail::invalid_code_point(lo);
@@ -154,28 +156,27 @@
detail::invalid_code_point(static_cast<char16>(value));
*out++ = value;
- return std::make_pair(++it, out);
+ ++begin;
+ return out;
}
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not a valid UTF-16 range. */
template<typename In, typename Out>
- std::pair<In, Out>
- rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
BOOST_ASSERT(begin != end);
BOOST_ASSERT(!is_surrogate(*begin) || is_high_surrogate(*begin));
-
- In it = --end;
- char32 value = *it;
+
+ In e = end;
+ char32 value = *--end;
if(unicode::is_low_surrogate(value))
{
// precondition; next value must have be a high-surrogate:
- if(it == begin)
- detail::invalid_utf_sequence(begin, end);
- --it;
+ if(end == begin)
+ detail::invalid_utf_sequence<16>(begin, e);
- char16 hi = *it;
+ char16 hi = *--end;
if(!unicode::is_high_surrogate(hi))
detail::invalid_code_point(hi);
@@ -186,7 +187,7 @@
detail::invalid_code_point(static_cast<char16>(value));
*out++ = value;
- return std::make_pair(it, out);
+ return out;
}
private:
@@ -270,114 +271,112 @@
void check(bool test, In begin, In end)
{
if(!test)
- detail::invalid_utf_sequence(begin, end);
+ detail::invalid_utf_sequence<8>(begin, end);
}
public:
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not a valid UTF-8 range. */
template<typename In, typename Out>
- std::pair<In, Out>
- ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
BOOST_ASSERT(begin != end);
- In p = begin;
+ In b = begin;
- unsigned char b0 = *(p++);
+ unsigned char b0 = *(begin++);
if((b0 & 0x80) == 0)
{
char32 r = b0;
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- check(p != end, begin, end);
- unsigned char b1 = *(p++);
- check((b1 & 0xc0) == 0x80, begin, end);
+ check(begin != end, b, end);
+ unsigned char b1 = *(begin++);
+ check((b1 & 0xc0) == 0x80, b, end);
if((b0 & 0xe0) == 0xc0)
{
char32 r = (b1 & 0x3f) | ((b0 & 0x1f) << 6);
- check(r >= 0x80, begin, end);
+ check(r >= 0x80, b, end);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- check(p != end, begin, end);
- unsigned char b2 = *(p++);
- check((b2 & 0xc0) == 0x80, begin, end);
+ check(begin != end, b, end);
+ unsigned char b2 = *(begin++);
+ check((b2 & 0xc0) == 0x80, b, end);
if((b0 & 0xf0) == 0xe0)
{
char32 r = (b2 & 0x3f) | ((b1 & 0x3f) << 6) | ((b0 & 0x0f) << 12);
- check(r >= 0x800, begin, end);
+ check(r >= 0x800, b, end);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- check(p != end, begin, end);
- unsigned char b3 = *(p++);
- check((b3 & 0xc0) == 0x80, begin, end);
+ check(begin != end, b, end);
+ unsigned char b3 = *(begin++);
+ check((b3 & 0xc0) == 0x80, b, end);
if((b0 & 0xf8) == 0xf0)
{
char32 r = (b3 & 0x3f) | ((b2 & 0x3f) << 6) | ((b1 & 0x3f) << 12) | ((b0 & 0x07) << 18);
- check(r >= 0x10000, begin, end);
+ check(r >= 0x10000, b, end);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- detail::invalid_utf_sequence(begin, end);
- return std::make_pair(p, out);
+ detail::invalid_utf_sequence<8>(b, end);
+ return out;
}
/** Throws \c std::out_of_range if [<tt>begin</tt>, <tt>end</tt>[ is not a valid UTF-8 range. */
template<typename In, typename Out>
- std::pair<In, Out>
- rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
BOOST_ASSERT(begin != end);
- In p = end;
+ In e = end;
- unsigned char b0 = *(--p);
+ unsigned char b0 = *(--end);
if((b0 & 0x80) == 0)
{
char32 r = b0;
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- check((b0 & 0xc0) == 0x80, begin, end);
- check(p != begin, begin, end);
- unsigned char b1 = *(--p);
+ check((b0 & 0xc0) == 0x80, begin, e);
+ check(end != begin, begin, e);
+ unsigned char b1 = *(--end);
if((b1 & 0xe0) == 0xc0)
{
char32 r = (b0 & 0x3f) | ((b1 & 0x1f) << 6);
- check(r >= 0x80, begin, end);
+ check(r >= 0x80, begin, e);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
check((b1 & 0xc0) == 0x80, begin, end);
- check(p != begin, begin, end);
- unsigned char b2 = *(--p);
+ check(end != begin, begin, e);
+ unsigned char b2 = *(--end);
if((b2 & 0xf0) == 0xe0)
{
char32 r = (b0 & 0x3f) | ((b1 & 0x3f) << 6) | ((b2 & 0x0f) << 12);
- check(r >= 0x800, begin, end);
+ check(r >= 0x800, begin, e);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- check((b2 & 0xc0) == 0x80, begin, end);
- check(p != begin, begin, end);
- unsigned char b3 = *(--p);
+ check((b2 & 0xc0) == 0x80, begin, e);
+ check(end != begin, begin, e);
+ unsigned char b3 = *(--end);
if((b3 & 0xf8) == 0xf0)
{
char32 r = (b0 & 0x3f) | ((b1 & 0x3f) << 6) | ((b2 & 0x3f) << 12) | ((b3 & 0x07) << 18);
- check(r >= 0x10000, begin, end);
+ check(r >= 0x10000, begin, e);
*out++ = r;
- return std::make_pair(p, out);
+ return out;
}
- detail::invalid_utf_sequence(begin, end);
- return std::make_pair(p, out);
+ detail::invalid_utf_sequence<8>(begin, e);
+ return out;
}
};
@@ -518,15 +517,13 @@
public:
template<typename In, typename Out>
- std::pair<In, Out>
- ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
return typename decoder<In>::type().ltr(begin, end, out);
}
template<typename In, typename Out>
- std::pair<In, Out>
- rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
return typename decoder<In>::type().rtl(begin, end, out);
}
@@ -590,7 +587,7 @@
/** Model of \c \xmlonly<conceptname>Converter</conceptname>\endxmlonly
* that converts from UTF-X to UTF-Y, X being detected from the value type
- * of the input range, Y being specified by the ValueType parameter */
+ * of the input range, Y being specified by the ValueType parameter. */
template<typename ValueType>
struct utf_transcoder : boost::converted_converter<
boost::unicode::utf_decoder,
Modified: sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Converter.xml
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Converter.xml (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Converter.xml 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -29,11 +29,17 @@
</sample-value>
</notation>
- <notation variables="begin end">
+ <notation variables="pos">
<sample-value>
<type name="In" />
</sample-value>
</notation>
+
+ <notation variables="next">
+ <sample-value>
+ <type name="In&" />
+ </sample-value>
+ </notation>
<notation variables="out">
<sample-value>
@@ -84,7 +90,7 @@
<type name="Converter" />
</sample-value>
<sample-value>
- <type name="In" />
+ <type name="In&" />
</sample-value>
<sample-value>
<type name="In" />
@@ -95,15 +101,15 @@
</apply-method>
<return-type>
<require-same-type testable="yes">
- <type name="std::pair<In, Out>"/>
+ <type name="Out"/>
</require-same-type>
</return-type>
<semantics>
- Reads part of the [<code>begin</code>, <code>end</code>[ range left to right,
- writes some elements of type <code>output_type</code> to <code>out</code>, and returns a pair
- indicating the new begin iterator and the past-the-end output iterator.
+ Reads part of the [<code>next</code>, <code>pos</code>[ range left to right, modifying
+ <code>next</code> as it advances, writes some elements of type <code>output_type</code>
+ to <code>out</code>, and returns the past-the-end output iterator.
</semantics>
- <precondition><code>begin != end</code></precondition>
+ <precondition><code>next != pos</code></precondition>
</valid-expression>
<valid-expression name="Right to left">
@@ -115,7 +121,7 @@
<type name="In" />
</sample-value>
<sample-value>
- <type name="In" />
+ <type name="In&" />
</sample-value>
<sample-value>
<type name="Out" />
@@ -123,15 +129,15 @@
</apply-method>
<return-type>
<require-same-type testable="yes">
- <type name="std::pair<In, Out>"/>
+ <type name="Out"/>
</require-same-type>
</return-type>
<semantics>
- Reads part of the [<code>begin</code>, <code>end</code>[ range right to left,
- writes some elements of type <code>output_type</code> to <code>out</code>, and returns a pair
- indicating the new past-the-end iterator and the past-the-end output iterator.
+ Reads part of the [<code>pos</code>, <code>next</code>[ range right to left, modifying
+ <code>next</code> as it advances, writes some elements of type <code>output_type</code>
+ to <code>out</code>, and returns the past-the-end output iterator.
</semantics>
- <precondition><code>begin != end</code></precondition>
+ <precondition><code>pos != next</code></precondition>
</valid-expression>
<example-model>
Modified: sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Segmenter.xml
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Segmenter.xml (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/doc/concepts/Segmenter.xml 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -27,11 +27,17 @@
</sample-value>
</notation>
- <notation variables="begin end">
+ <notation variables="pos">
<sample-value>
<type name="In" />
</sample-value>
</notation>
+
+ <notation variables="next">
+ <sample-value>
+ <type name="In&" />
+ </sample-value>
+ </notation>
<associated-type name="input_type">
<get-member-type name="input_type">
@@ -56,7 +62,7 @@
<type name="Segmenter" />
</sample-value>
<sample-value>
- <type name="In" />
+ <type name="In&" />
</sample-value>
<sample-value>
<type name="In" />
@@ -64,14 +70,14 @@
</apply-method>
<return-type>
<require-same-type testable="yes">
- <type name="In"/>
+ <type name="void"/>
</require-same-type>
</return-type>
<semantics>
- Reads part of the [<code>begin</code>, <code>end</code>[ range left to right,
- and returns the new begin iterator.
+ Reads part of the [<code>next</code>, <code>pos</code>[ range left to right,
+ modifying <code>next</code> as it advances.
</semantics>
- <precondition><code>begin != end</code></precondition>
+ <precondition><code>next != pos</code></precondition>
</valid-expression>
<valid-expression name="Right to left">
@@ -83,19 +89,19 @@
<type name="In" />
</sample-value>
<sample-value>
- <type name="In" />
+ <type name="In&" />
</sample-value>
</apply-method>
<return-type>
<require-same-type testable="yes">
- <type name="In"/>
+ <type name="void"/>
</require-same-type>
</return-type>
<semantics>
- Reads part of the [<code>begin</code>, <code>end</code>[ range right to left,
- and returns the new past-the-end iterator.
+ Reads part of the [<code>pos</code>, <code>next</code>[ range right to left,
+ modifying <code>next</code> as it advances.
</semantics>
- <precondition><code>begin != end</code></precondition>
+ <precondition><code>pos != next</code></precondition>
</valid-expression>
<example-model>
Modified: sandbox/SOC/2009/unicode/libs/unicode/doc/users_manual.qbk
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/doc/users_manual.qbk (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/doc/users_manual.qbk 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -1,8 +1,8 @@
[library Unicode
[quickbook 1.3]
- [version 0.1 preview 3]
+ [version 0.1 preview 4]
[authors [Gaunard, Mathias]]
- [copyright 2009 Mathias Gaunard]
+ [copyright 2009-2010 Mathias Gaunard]
[category string-text]
[purpose Internationalized text handling in C++ with Unicode]
[license
@@ -266,9 +266,7 @@
[heading Segmenter]
A model of the [conceptref Segmenter] concept is a class that takes an
input range, specified as two iterators, and consumes it left-to-right
-or right-to-left, that is to say it returns an iterator with the new
-begin in the case of left-to-right consuming, and the new end in the case
-of right-to-left consuming.
+or right-to-left, modifying the appropriate iterator as it advances.
Semantically, a right-to-left consuming done after a left-to-right consuming
should restore the original position. Indeed, both primitives need to
@@ -282,20 +280,20 @@
typedef int input_type;
template<typename In>
- In ltr(In begin, In end)
+ void ltr(In& begin, In end)
{
return ++begin;
}
template<typename In>
- In rtl(In begin, In end)
+ void rtl(In begin, In& end)
{
return --end;
}
};``
A model of the [conceptref Segmenter] concept may then be used to segment
-a range. The [classref boost::segment_iterator], eventually invoked
+a range. The [classref boost::segmented_range], returned by
by [funcref boost::adaptors::segment], can be used to exploit that concept to
turn a range into a range of subranges.
@@ -305,18 +303,16 @@
[heading Converter]
A model of the [conceptref Converter] concept is a class that takes an input
range, specified as two iterators, consumes it left-to-right
-or right-to-left, writes some elements to an output iterator, and returns
-the new begin in the case of left-to-right consuming or the new end
-in the case of right-to-left consuming, as well as the new output
-iterator.
+or right-to-left, modifying the appropriate iterator as it advances,
+writes some elements to an output iterator, and returns it.
In terms of semantics, not only does the consuming need to be symmetric,
but the output shall also be the same for a given consumed subrange,
whatever the consuming direction.
Furthermore, the output shall always be ordered left-to-right, even when
-applying the convert right-to-left.
+applying the conversion right-to-left.
-Here is an example of a convert that converts two adjacent numbers into the
+Here is an example of a converter that converts two adjacent numbers into the
two numbers reversed, in a range of integers that must have an
even number of elements; indeed, for the two operations to be symmetric
here, there is not really another way.
@@ -327,7 +323,7 @@
typedef mpl::int_<2> max_output;
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
int i = *begin++;
if(begin == end)
@@ -335,31 +331,31 @@
*out++ = *begin++;
*out++ = i;
- return std::make_pair(begin, out);
+ return out;
}
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
*out++ = *--end;
if(end == begin)
throw std::out_of_range();
*out++ = *--end;
- return std::make_pair(end, out);
+ return out;
}
};``
A model of the [conceptref Converter] concept may then be used to perform
a many-to-many conversion on a whole range, be it eagerly (by calling
-repeatly the convert) or lazily (be evaluating it step by step as an
+repeatly the converter) or lazily (be evaluating it step by step as an
iterator adapter is advanced).
The [funcref boost::convert] function provides the former, while the
[funcref boost::adaptors::convert] function which returns a range in terms of
-[classref boost::convert_iterator] provides the latter.
+[classref boost::converted_range] provides the latter.
-With the above example, a convertd range [1, 2, 3, 4] would be converted
+With the above example, the range [1, 2, 3, 4] would be converted
to [2, 1, 4, 3].
[heading OneManyConverter]
@@ -367,7 +363,7 @@
Additionally, there is a refinement of the [conceptref Converter] concept named
[conceptref OneManyConverter], where one element is converted to many.
-This allows avoiding the consuming altogether so that the convert can be
+This allows avoiding managing iterator advancement; the converter can be
defined as a single function that takes a value, an output iterator,
and returns it.
@@ -386,11 +382,11 @@
Conversions can be applied in a variety of means, all generated from using
the [conceptref Converter] concept that performs one step of the conversion:
-* Eager evaluation, with simply
+* Eager evaluation, which simply
loops the =Converter= until the whole input range has been treated.
* Lazy evaluation, where a new range is returned that wraps the input range
and converts step-by-step as the range is advanced. The resulting range is
-however read-only. It is implemented in terms of [classref boost::convert_iterator].
+however read-only. It is implemented in terms of [classref boost::converted_range].
* Lazy output evaluation, where an output iterator is returned that wraps the output
and converts every pushed element with a [conceptref OneManyConverter]. It is implemented in terms
of [classref boost::convert_output_iterator].
@@ -414,7 +410,7 @@
As a matter of fact, a =Converter= can be converted to =Segmenter= using [classref boost::converter_segmenter].
Segmentation may be done either by using the appropriate =Segmenter= directly, or by using the
-[classref boost::segment_iterator] template to adapt the range into a
+[classref boost::segmented_range] template to adapt the range into a
read-only range of subranges.
Additionally, the [conceptref BoundaryChecker] concept may prove useful to tell whether
Modified: sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_convert.cpp
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_convert.cpp (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_convert.cpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -22,7 +22,7 @@
}
template<typename In, typename Out>
- std::pair<In, Out> ltr(In begin, In end, Out out)
+ Out ltr(In& begin, In end, Out out)
{
for(int i=0; i<count; i++)
*out++ = *begin + i;
@@ -30,11 +30,11 @@
if(++begin != end)
++count;
- return std::make_pair(begin, out);
+ return out;
}
template<typename In, typename Out>
- std::pair<In, Out> rtl(In begin, In end, Out out)
+ Out rtl(In begin, In& end, Out out)
{
--end;
for(int i=0; i<count; i++)
@@ -43,7 +43,7 @@
if(end != begin)
--count;
- return std::make_pair(end, out);
+ return out;
}
int count;
Modified: sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_segment.cpp
==============================================================================
--- sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_segment.cpp (original)
+++ sandbox/SOC/2009/unicode/libs/unicode/test/iterator/test_segment.cpp 2010-07-18 13:26:24 EDT (Sun, 18 Jul 2010)
@@ -21,7 +21,7 @@
}
template<typename In>
- In ltr(In begin, In end)
+ void ltr(In& begin, In end)
{
BOOST_ASSERT(std::distance(begin, end) >= count);
@@ -30,11 +30,10 @@
if(begin != end)
++count;
- return begin;
}
template<typename In>
- In rtl(In begin, In end)
+ void rtl(In begin, In& end)
{
BOOST_ASSERT(std::distance(begin, end) >= count);
@@ -43,7 +42,6 @@
if(end != begin)
--count;
- return end;
}
int count;
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