forked from boostorg/range
Boost.Range minor documentation corrections and code comment fixes.
[SVN r61014]
This commit is contained in:
@ -11,7 +11,7 @@ template<
|
||||
OutputIterator merge(const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
OutputIterator out);
|
||||
|
||||
|
||||
template<
|
||||
class SinglePassRange1,
|
||||
class SinglePassRange2,
|
||||
@ -68,8 +68,8 @@ Defined in the header file `boost/range/algorithm/merge.hpp`
|
||||
|
||||
[heading For the predicate version:]
|
||||
|
||||
* The elements of `rng1` is in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng1`, `pred(y, x) == false`.
|
||||
* The elements of `rng2` is in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng2`, `pred(y, x) == false`.
|
||||
* The elements of `rng1` are in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng1`, `pred(y, x) == false`.
|
||||
* The elements of `rng2` are in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng2`, `pred(y, x) == false`.
|
||||
* The ranges `rng1` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
|
||||
* The ranges `rng2` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
|
||||
* `[out, out + distance(rng1) + distance(rng2))` is a valid range.
|
||||
|
@ -30,7 +30,7 @@ stable_partition(const ForwardRange& rng, UnaryPredicate pred);
|
||||
|
||||
[heading Description]
|
||||
|
||||
`stable_partition` reorders the elements in the range `rng` base on the function object `pred`. Once this function has completed all of the elements that satisfy `pred` appear before all of the elements that fail to satisfy it. `stable_partition` differs from `partition` because it preserves relative order. It is table.
|
||||
`stable_partition` reorders the elements in the range `rng` base on the function object `pred`. Once this function has completed all of the elements that satisfy `pred` appear before all of the elements that fail to satisfy it. `stable_partition` differs from `partition` because it preserves relative order. It is stable.
|
||||
|
||||
For the versions that return an iterator, the return value is the iterator to the first element that fails to satisfy `pred`.
|
||||
|
||||
|
@ -64,7 +64,7 @@ A complete example is given here:
|
||||
template< class T >
|
||||
struct Pair
|
||||
{
|
||||
T first, last;
|
||||
T first, last;
|
||||
};
|
||||
|
||||
} // namespace 'Foo'
|
||||
@ -99,31 +99,31 @@ A complete example is given here:
|
||||
{
|
||||
//
|
||||
// The required functions. These should be defined in
|
||||
// the same namespace as 'Pair', in this case
|
||||
// the same namespace as 'Pair', in this case
|
||||
// in namespace 'Foo'.
|
||||
//
|
||||
|
||||
|
||||
template< class T >
|
||||
inline T range_begin( Pair<T>& x )
|
||||
{
|
||||
{
|
||||
return x.first;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline T range_begin( const Pair<T>& x )
|
||||
{
|
||||
{
|
||||
return x.first;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline T range_end( Pair<T>& x )
|
||||
{
|
||||
{
|
||||
return x.last;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline T range_end( const Pair<T>& x )
|
||||
{
|
||||
{
|
||||
return x.last;
|
||||
}
|
||||
|
||||
@ -131,14 +131,14 @@ A complete example is given here:
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
typedef std::vector<int>::iterator iter;
|
||||
std::vector<int> vec;
|
||||
Foo::Pair<iter> pair = { vec.begin(), vec.end() };
|
||||
const Foo::Pair<iter>& cpair = pair;
|
||||
const Foo::Pair<iter>& cpair = pair;
|
||||
//
|
||||
// Notice that we call 'begin' etc with qualification.
|
||||
// Notice that we call 'begin' etc with qualification.
|
||||
//
|
||||
iter i = boost::begin( pair );
|
||||
iter e = boost::end( pair );
|
||||
@ -149,7 +149,9 @@ A complete example is given here:
|
||||
boost::range_reverse_iterator< const Foo::Pair<iter> >::type
|
||||
ri = boost::rbegin( cpair ),
|
||||
re = boost::rend( cpair );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
[endsect]
|
||||
@ -175,11 +177,11 @@ private:
|
||||
typedef boost::iterator_range<
|
||||
boost::reverse_iterator<
|
||||
typename boost::range_iterator<R>::type> > base;
|
||||
|
||||
|
||||
public:
|
||||
typedef boost::reverse_iterator<
|
||||
typename boost::range_iterator<R>::type > iterator;
|
||||
|
||||
|
||||
reverse_range(R& r)
|
||||
: base(iterator(boost::end(r)), iterator(boost::begin(r)))
|
||||
{ }
|
||||
@ -196,17 +198,17 @@ namespace detail {
|
||||
# Implement `operator|`
|
||||
``
|
||||
template< class BidirectionalRng >
|
||||
inline reverse_range<BidirectionalRng>
|
||||
inline reverse_range<BidirectionalRng>
|
||||
operator|( BidirectionalRng& r, detail::reverse_forwarder )
|
||||
{
|
||||
return reverse_range<BidirectionalRng>( r );
|
||||
return reverse_range<BidirectionalRng>( r );
|
||||
}
|
||||
|
||||
template< class BidirectionalRng >
|
||||
inline reverse_range<const BidirectionalRng>
|
||||
inline reverse_range<const BidirectionalRng>
|
||||
operator|( const BidirectionalRng& r, detail::reverse_forwarder )
|
||||
{
|
||||
return reverse_range<const BidirectionalRng>( r );
|
||||
return reverse_range<const BidirectionalRng>( r );
|
||||
}
|
||||
``
|
||||
|
||||
@ -226,12 +228,12 @@ class replace_value
|
||||
public:
|
||||
typedef const Value& result_type;
|
||||
typedef const Value& argument_type;
|
||||
|
||||
|
||||
replace_value(const Value& from, const Value& to)
|
||||
: m_from(from), m_to(to)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const Value& operator()(const Value& x) const
|
||||
{
|
||||
return (x == m_from) ? m_to : x;
|
||||
@ -254,7 +256,7 @@ private:
|
||||
typedef replace_value<value_type> Fn;
|
||||
typedef boost::transform_iterator<Fn, iterator_base> replaced_iterator;
|
||||
typedef boost::iterator_range<replaced_iterator> base_t;
|
||||
|
||||
|
||||
public:
|
||||
replace_range(Range& rng, value_type from, value_type to)
|
||||
: base_t(replaced_iterator(boost::begin(rng), Fn(from,to)),
|
||||
@ -263,7 +265,7 @@ public:
|
||||
}
|
||||
};
|
||||
``
|
||||
|
||||
|
||||
# Implement a holder class to hold the arguments required to construct the RangeAdaptor.
|
||||
|
||||
The holder combines multiple parameters into one that can be passed as the right operand of `operator|()`.
|
||||
|
@ -8,7 +8,7 @@ template<class SinglePassRange1,
|
||||
class Value>
|
||||
Value inner_product( const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
Value init);
|
||||
Value init );
|
||||
|
||||
template<class SinglePassRange1,
|
||||
class SinglePassRange2,
|
||||
@ -18,7 +18,7 @@ template<class SinglePassRange1,
|
||||
Value inner_product( const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
Value init,
|
||||
BinaryOperation1 op1,
|
||||
BinaryOperation1 op1 );
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[section Overview]
|
||||
|
||||
Four types of objects are currently supported by the library:
|
||||
Three types of objects are currently supported by the library:
|
||||
|
||||
* standard-like containers
|
||||
* `std::pair<iterator,iterator>`
|
||||
|
Reference in New Issue
Block a user