forked from boostorg/range
[boost][range] - Trac 5971 - size() should return an unsigned type.
[SVN r77990]
This commit is contained in:
@ -41,7 +41,7 @@ BOOST_FOREACH (CList<CString> *theList, myArray)
|
||||
|
||||
* Boost C++ Libraries Version 1.34.0 or later (no compilation required)
|
||||
* Visual C++ 7.1 or later (for MFC and ATL)
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:mfc_ranges MFC Ranges]
|
||||
|
@ -19,7 +19,7 @@ For maximum portability you should follow these guidelines:
|
||||
# use __const_begin__`()` and __const_end__`()` whenever your code by intention is read-only; this will also solve most rvalue problems,
|
||||
# do not rely on ADL:
|
||||
* if you overload functions, include that header before the headers in this library,
|
||||
* put all overloads in namespace boost.
|
||||
* put all overloads in namespace boost.
|
||||
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
||||
]
|
||||
[
|
||||
[`size(x)`]
|
||||
[`range_difference<X>::type`]
|
||||
[`range_size<X>::type`]
|
||||
[`range_calculate_size(x)` which by default is `boost::end(x) - boost::begin(x)`. Users may supply alternative implementations by implementing `range_calculate_size(x)` so that it will be found via ADL]
|
||||
[constant time]
|
||||
]
|
||||
|
@ -20,10 +20,10 @@ namespace boost
|
||||
|
||||
template< class T >
|
||||
struct range_reference;
|
||||
|
||||
|
||||
template< class T >
|
||||
struct range_pointer;
|
||||
|
||||
|
||||
template< class T >
|
||||
struct range_category;
|
||||
|
||||
@ -92,11 +92,11 @@ namespace boost
|
||||
template< class T >
|
||||
typename range_reverse_iterator<const T>::type
|
||||
rend( const T& r );
|
||||
|
||||
|
||||
//
|
||||
// Random Access Range functions
|
||||
//
|
||||
|
||||
|
||||
template< class T >
|
||||
typename range_difference<T>::type
|
||||
size( const T& r );
|
||||
@ -106,42 +106,42 @@ namespace boost
|
||||
//
|
||||
|
||||
template< class T >
|
||||
typename range_iterator<const T>::type
|
||||
typename range_iterator<const T>::type
|
||||
const_begin( const T& r );
|
||||
|
||||
template< class T >
|
||||
typename range_iterator<const T>::type
|
||||
typename range_iterator<const T>::type
|
||||
const_end( const T& r );
|
||||
|
||||
template< class T >
|
||||
typename range_reverse_iterator<const T>::type
|
||||
typename range_reverse_iterator<const T>::type
|
||||
const_rbegin( const T& r );
|
||||
|
||||
template< class T >
|
||||
typename range_reverse_iterator<const T>::type
|
||||
typename range_reverse_iterator<const T>::type
|
||||
const_rend( const T& r );
|
||||
|
||||
|
||||
//
|
||||
// String utilities
|
||||
//
|
||||
|
||||
|
||||
template< class T >
|
||||
iterator_range< ... see below ... >
|
||||
as_literal( T& r );
|
||||
|
||||
|
||||
template< class T >
|
||||
iterator_range< ... see below ... >
|
||||
as_literal( const T& r );
|
||||
|
||||
|
||||
template< class T >
|
||||
iterator_range< typename range_iterator<T>::type >
|
||||
as_array( T& r );
|
||||
|
||||
|
||||
template< class T >
|
||||
iterator_range< typename range_iterator<const T>::type >
|
||||
as_array( const T& r );
|
||||
|
||||
} // namespace 'boost'
|
||||
} // namespace 'boost'
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
@ -40,23 +40,23 @@ namespace boost
|
||||
public: // construction, assignment
|
||||
template< class ForwardTraversalIterator2 >
|
||||
iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End );
|
||||
|
||||
|
||||
template< class ForwardRange >
|
||||
iterator_range( ForwardRange& r );
|
||||
|
||||
|
||||
template< class ForwardRange >
|
||||
iterator_range( const ForwardRange& r );
|
||||
|
||||
|
||||
template< class ForwardRange >
|
||||
iterator_range& operator=( ForwardRange& r );
|
||||
|
||||
template< class ForwardRange >
|
||||
iterator_range& operator=( const ForwardRange& r );
|
||||
|
||||
|
||||
public: // Forward Range functions
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
|
||||
|
||||
public: // convenience
|
||||
operator unspecified_bool_type() const;
|
||||
bool equal( const iterator_range& ) const;
|
||||
@ -65,25 +65,25 @@ namespace boost
|
||||
iterator_range& advance_begin(difference_type n);
|
||||
iterator_range& advance_end(difference_type n);
|
||||
bool empty() const;
|
||||
// for Random Access Range only:
|
||||
// for Random Access Range only:
|
||||
reference operator[]( difference_type at ) const;
|
||||
value_type operator()( difference_type at ) const;
|
||||
size_type size() const;
|
||||
};
|
||||
|
||||
|
||||
// stream output
|
||||
template< class ForwardTraversalIterator, class T, class Traits >
|
||||
std::basic_ostream<T,Traits>&
|
||||
std::basic_ostream<T,Traits>&
|
||||
operator<<( std::basic_ostream<T,Traits>& Os,
|
||||
const iterator_range<ForwardTraversalIterator>& r );
|
||||
|
||||
// comparison
|
||||
template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
|
||||
bool operator==( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator==( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const iterator_range<ForwardTraversalIterator2>& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
bool operator==( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator==( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const ForwardRange& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
@ -91,11 +91,11 @@ namespace boost
|
||||
const iterator_range<ForwardTraversalIterator>& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
|
||||
bool operator!=( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator!=( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const iterator_range<ForwardTraversalIterator2>& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
bool operator!=( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator!=( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const ForwardRange& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
@ -103,23 +103,23 @@ namespace boost
|
||||
const iterator_range<ForwardTraversalIterator>& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
|
||||
bool operator<( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator<( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const iterator_range<ForwardTraversalIterator2>& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
bool operator<( const iterator_range<ForwardTraversalIterator>& l,
|
||||
bool operator<( const iterator_range<ForwardTraversalIterator>& l,
|
||||
const ForwardRange& r );
|
||||
|
||||
template< class ForwardTraversalIterator, class ForwardRange >
|
||||
bool operator<( const ForwardRange& l,
|
||||
const iterator_range<ForwardTraversalIterator>& r );
|
||||
|
||||
|
||||
// external construction
|
||||
template< class ForwardTraversalIterator >
|
||||
iterator_range< ForwardTraversalIterator >
|
||||
make_iterator_range( ForwardTraversalIterator Begin,
|
||||
make_iterator_range( ForwardTraversalIterator Begin,
|
||||
ForwardTraversalIterator End );
|
||||
|
||||
|
||||
template< class ForwardRange >
|
||||
iterator_range< typename range_iterator<ForwardRange>::type >
|
||||
make_iterator_range( ForwardRange& r );
|
||||
@ -127,25 +127,25 @@ namespace boost
|
||||
template< class ForwardRange >
|
||||
iterator_range< typename range_iterator<const ForwardRange>::type >
|
||||
make_iterator_range( const ForwardRange& r );
|
||||
|
||||
|
||||
template< class Range >
|
||||
iterator_range< typename range_iterator<Range>::type >
|
||||
make_iterator_range( Range& r,
|
||||
typename range_difference<Range>::type advance_begin,
|
||||
typename range_difference<Range>::type advance_end );
|
||||
|
||||
|
||||
template< class Range >
|
||||
iterator_range< typename range_iterator<const Range>::type >
|
||||
make_iterator_range( const Range& r,
|
||||
make_iterator_range( const Range& r,
|
||||
typename range_difference<const Range>::type advance_begin,
|
||||
typename range_difference<const Range>::type advance_end );
|
||||
|
||||
|
||||
// convenience
|
||||
template< class Sequence, class ForwardRange >
|
||||
Sequence copy_range( const ForwardRange& r );
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
``
|
||||
``
|
||||
|
||||
If an instance of `iterator_range` is constructed by a client with two iterators, the client must ensure that the two iterators delimit a valid closed-open range [begin,end).
|
||||
|
||||
@ -177,7 +177,7 @@ It is worth noticing that the templated constructors and assignment operators al
|
||||
|
||||
``
|
||||
iterator_range make_iterator_range( Range& r,
|
||||
typename range_difference<Range>::type advance_begin,
|
||||
typename range_difference<Range>::type advance_begin,
|
||||
typename range_difference<Range>::type advance_end );
|
||||
``
|
||||
|
||||
@ -209,46 +209,46 @@ namespace boost
|
||||
template< class ForwardRange >
|
||||
class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type >
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef typename range_iterator<ForwardRange>::type iterator;
|
||||
typedef typename range_iterator<const ForwardRange>::type const_iterator;
|
||||
typedef typename iterator_difference<iterator>::type difference_type;
|
||||
|
||||
|
||||
public: // construction, assignment
|
||||
template< class ForwardTraversalIterator >
|
||||
sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End );
|
||||
|
||||
template< class ForwardRange2 >
|
||||
sub_range( ForwardRange2& r );
|
||||
|
||||
|
||||
template< class ForwardRange2 >
|
||||
sub_range( const Range2& r );
|
||||
|
||||
|
||||
template< class ForwardRange2 >
|
||||
sub_range& operator=( ForwardRange2& r );
|
||||
|
||||
template< class ForwardRange2 >
|
||||
sub_range& operator=( const ForwardRange2& r );
|
||||
|
||||
public: // Forward Range functions
|
||||
sub_range& operator=( const ForwardRange2& r );
|
||||
|
||||
public: // Forward Range functions
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
|
||||
public: // convenience
|
||||
const_iterator end() const;
|
||||
|
||||
public: // convenience
|
||||
value_type& front();
|
||||
const value_type& front() const;
|
||||
value_type& back();
|
||||
const value_type& back() const;
|
||||
// for Random Access Range only:
|
||||
// for Random Access Range only:
|
||||
value_type& operator[]( size_type at );
|
||||
const value_type& operator[]( size_type at ) const;
|
||||
|
||||
|
||||
public:
|
||||
// rest of interface inherited from iterator_range
|
||||
};
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
``
|
||||
|
||||
|
@ -13,7 +13,7 @@ Since ranges are characterized by a specific underlying iterator type, we get a
|
||||
* Readable Range
|
||||
* Writeable Range
|
||||
* Swappable Range
|
||||
* Lvalue Range
|
||||
* Lvalue Range
|
||||
* [*/Traversal/] category:
|
||||
* __single_pass_range__
|
||||
* __forward_range__
|
||||
@ -25,7 +25,7 @@ Notice how we have used the categories from the __new_style_iterators__.
|
||||
Notice that an iterator (and therefore an range) has one [*/traversal/] property and one or more properties from the [*/value access/] category. So in reality we will mostly talk about mixtures such as
|
||||
|
||||
* Random Access Readable Writeable Range
|
||||
* Forward Lvalue Range
|
||||
* Forward Lvalue Range
|
||||
|
||||
By convention, we should always specify the [*/traversal/] property first as done above. This seems reasonable since there will only be one [*/traversal/] property, but perhaps many [*/value access/] properties.
|
||||
|
||||
@ -37,7 +37,7 @@ As another example, consider how we specify the interface of `std::sort()`. Algo
|
||||
template< class RandomAccessTraversalReadableWritableIterator >
|
||||
void sort( RandomAccessTraversalReadableWritableIterator first,
|
||||
RandomAccessTraversalReadableWritableIterator last );
|
||||
``
|
||||
``
|
||||
|
||||
For ranges the interface becomes
|
||||
|
||||
@ -45,6 +45,6 @@ For ranges the interface becomes
|
||||
template< class RandomAccessReadableWritableRange >
|
||||
void sort( RandomAccessReadableWritableRange& r );
|
||||
``
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -5,6 +5,12 @@
|
||||
/]
|
||||
[section:upgrade Upgrade version of Boost.Range]
|
||||
|
||||
[section:upgrade_from_1_49 Upgrade from version 1.49]
|
||||
|
||||
# __size__ now returns the type Rng::size_type if the range has size_type;
|
||||
otherwise range_size<Rng>::type is used. This is the distance type promoted to
|
||||
an unsigned type.
|
||||
|
||||
[section:upgrade_from_1_45 Upgrade from version 1.45]
|
||||
|
||||
# __size__ in addition to supporting __random_access_range__ now also supports extensibility via calls to the unqualified `range_calculate_size(rng)` function.
|
||||
|
20
include/boost/range/algorithm/equal.hpp
Executable file → Normal file
20
include/boost/range/algorithm/equal.hpp
Executable file → Normal file
@ -31,7 +31,7 @@ namespace boost
|
||||
IteratorCategoryTag1,
|
||||
IteratorCategoryTag2 )
|
||||
{
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
// If we have reached the end of the left range then this is
|
||||
// the end of the loop. They are equal if and only if we have
|
||||
@ -46,7 +46,12 @@ namespace boost
|
||||
return false;
|
||||
|
||||
// continue looping if and only if the values are equal
|
||||
} while(*first1++ == *first2++);
|
||||
if (*first1 != *first2)
|
||||
break;
|
||||
|
||||
++first1;
|
||||
++first2;
|
||||
}
|
||||
|
||||
// Reaching this line in the algorithm indicates that a value
|
||||
// inequality has been detected.
|
||||
@ -66,7 +71,7 @@ namespace boost
|
||||
IteratorCategoryTag1,
|
||||
IteratorCategoryTag2 )
|
||||
{
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
// If we have reached the end of the left range then this is
|
||||
// the end of the loop. They are equal if and only if we have
|
||||
@ -81,7 +86,12 @@ namespace boost
|
||||
return false;
|
||||
|
||||
// continue looping if and only if the values are equal
|
||||
} while(pred(*first1++, *first2++));
|
||||
if (!pred(*first1, *first2))
|
||||
break;
|
||||
|
||||
++first1;
|
||||
++first2;
|
||||
}
|
||||
|
||||
// Reaching this line in the algorithm indicates that a value
|
||||
// inequality has been detected.
|
||||
@ -182,7 +192,7 @@ namespace boost
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::equal;
|
||||
using ::boost::range::equal;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
8
include/boost/range/algorithm_ext/copy_n.hpp
Executable file → Normal file
8
include/boost/range/algorithm_ext/copy_n.hpp
Executable file → Normal file
@ -30,15 +30,15 @@ namespace boost
|
||||
///
|
||||
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
|
||||
/// \pre OutputIterator is a model of the OutputIteratorConcept
|
||||
/// \pre 0 <= n < distance(rng)
|
||||
/// \pre 0 <= n <= distance(rng)
|
||||
template< class SinglePassRange, class Size, class OutputIterator >
|
||||
inline OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator out)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
|
||||
BOOST_ASSERT( n < static_cast<Size>(boost::distance(rng)) );
|
||||
BOOST_ASSERT( n <= static_cast<Size>(::boost::distance(rng)) );
|
||||
BOOST_ASSERT( n >= static_cast<Size>(0) );
|
||||
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type source = boost::begin(rng);
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type source = ::boost::begin(rng);
|
||||
|
||||
for (Size i = 0; i < n; ++i, ++out, ++source)
|
||||
*out = *source;
|
||||
@ -47,7 +47,7 @@ inline OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::copy_n;
|
||||
using ::boost::range::copy_n;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
41
include/boost/range/detail/size_type.hpp
Executable file → Normal file
41
include/boost/range/detail/size_type.hpp
Executable file → Normal file
@ -17,12 +17,19 @@
|
||||
// missing partial specialization workaround.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< typename T >
|
||||
struct range_size_type_;
|
||||
struct range_size_type_
|
||||
{
|
||||
template< typename C >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<std_container_>
|
||||
@ -33,36 +40,14 @@ namespace boost
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template<>
|
||||
struct range_size_type_<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<array_>
|
||||
{
|
||||
template< typename A >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
class range_size
|
||||
{
|
||||
typedef typename range_detail::range<C>::type c_type;
|
||||
public:
|
||||
typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||
typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -26,7 +26,7 @@ namespace boost
|
||||
namespace range_detail
|
||||
{
|
||||
template<class SinglePassRange>
|
||||
inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type
|
||||
inline BOOST_DEDUCED_TYPENAME range_size<const SinglePassRange>::type
|
||||
range_calculate_size(const SinglePassRange& rng)
|
||||
{
|
||||
BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 &&
|
||||
@ -36,7 +36,7 @@ namespace boost
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type
|
||||
inline BOOST_DEDUCED_TYPENAME range_size<const SinglePassRange>::type
|
||||
size(const SinglePassRange& rng)
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
|
@ -16,11 +16,13 @@
|
||||
#endif
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#include <boost/range/detail/size_type.hpp>
|
||||
#else
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
@ -33,36 +35,44 @@ namespace boost
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// default
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename C >
|
||||
|
||||
template<typename T>
|
||||
class has_size_type
|
||||
{
|
||||
typedef char no_type;
|
||||
struct yes_type { char dummy[2]; };
|
||||
|
||||
template<typename C>
|
||||
static yes_type test(BOOST_DEDUCED_TYPENAME C::size_type x);
|
||||
|
||||
template<typename C, typename Arg>
|
||||
static no_type test(Arg x);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
|
||||
};
|
||||
|
||||
template<typename C, typename Enabler=void>
|
||||
struct range_size
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME make_unsigned<
|
||||
BOOST_DEDUCED_TYPENAME range_difference<C>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<typename C>
|
||||
struct range_size<
|
||||
C,
|
||||
BOOST_DEDUCED_TYPENAME enable_if<has_size_type<C>, void>::type
|
||||
>
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME C::size_type type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
struct range_size< std::pair<Iterator,Iterator> >
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
struct range_size< T[sz] >
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template< class T >
|
||||
struct range_size :
|
||||
struct range_size :
|
||||
detail::range_size<T>
|
||||
{ };
|
||||
|
||||
@ -70,7 +80,7 @@ namespace boost
|
||||
struct range_size<const T >
|
||||
: detail::range_size<T>
|
||||
{ };
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
@ -44,7 +44,7 @@ namespace boost
|
||||
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() );
|
||||
|
||||
fn_t result_fn2 = boost::for_each(boost::make_iterator_range(rng), fn_t(rng));
|
||||
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() );
|
||||
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn2.invocation_count() );
|
||||
|
||||
// Test the constant version
|
||||
const SinglePassRange& cref_rng = rng;
|
||||
|
@ -40,7 +40,7 @@ namespace boost_range_extension_size_test
|
||||
impl_t m_impl;
|
||||
};
|
||||
|
||||
inline boost::range_difference<std::list<int> >::type
|
||||
inline boost::range_size<std::list<int> >::type
|
||||
range_calculate_size(const FooWithoutSize& rng)
|
||||
{
|
||||
return 2u;
|
||||
|
Reference in New Issue
Block a user