Compare commits

..

25 Commits

Author SHA1 Message Date
125c04d8fa Release 1.51.0
[SVN r80098]
2012-08-20 22:07:05 +00:00
dc46fc13ab [boost][range] - Merge trac resolutions from the trunk. The most notable change is the alteration of the size type to be unsigned. This is a potentially breaking change.
[SVN r78860]
2012-06-08 22:59:54 +00:00
2f3d82be9f [boost][range] - merge from trunk of miscellaneous defect fixes
[SVN r72427]
2011-06-05 21:47:57 +00:00
47e478d099 Merge to release.
[SVN r72228]
2011-05-27 19:51:13 +00:00
126e6861d7 [boost][range] - Resolved Trace 5162 - boost::iterator_range<T*> is unsafe.
[SVN r70852]
2011-04-02 13:05:26 +00:00
d490a84c8d [boost][range] - Improved the work-around for VC10 for_each implementation. Corrected a missing newline at the end of the file.
[SVN r70850]
2011-04-02 10:14:51 +00:00
10af4fc1e0 [boost][range] - Improve the forwarding of the functor, and provide a work-around for the breaking changes in VC10 for_each.
[SVN r70690]
2011-03-29 10:27:00 +00:00
f8bb8aafbf [range] - Improved default Reference type deduction for the join_iterator as implemented by aschoedl in Trac issue 5061.
[SVN r70041]
2011-03-16 23:55:25 +00:00
c6a6a46db4 [range] - Fix for the demotion of traversal tags supplied by aschoedl. This is mentioned in Trac issue 5061, but has also been reported independently by a few users.
[SVN r70040]
2011-03-16 23:47:02 +00:00
cc8a1413cb [range] - Qualify the lookup of the make_transform_iterator function to protect against ADL. This was reported as part of Trac issue 5061.
[SVN r70039]
2011-03-16 23:41:12 +00:00
1131136d4a [range] - Fix for Trac issue 5313 - Typos in boost/range/detail/detail_str.hpp
[SVN r70038]
2011-03-16 23:37:03 +00:00
3cd6a7277f [range] Added <=, ==, >, >=, != operators to iterator_range
[SVN r70037]
2011-03-16 23:33:57 +00:00
19a2090ef8 [range] - Fix for Trac issue 5295 - boost/range/sub_range.hpp cannot be included by itself
[SVN r70036]
2011-03-16 23:31:59 +00:00
67f457ade1 [range] Fix for Trac issue 5179 - Extra ";" in boost range file
[SVN r70035]
2011-03-16 23:29:29 +00:00
7315e2c14e [range] resolved trac issue 5295 - sub_range.hpp was missing an include of concepts.hpp
[SVN r70034]
2011-03-16 23:20:12 +00:00
96c78123f0 [boost][range] - Fixed erroneous change by 'Wash' the size() function is intended to be for Random Access Ranges only to be in keeping with the other Boost.Range size() functions.
[SVN r68177]
2011-01-16 00:05:12 +00:00
868858b844 Fixed ambiguity issues when compiling with C++0x support enabled.
[SVN r68155]
2011-01-14 17:37:59 +00:00
367582d0f4 Removed the use of __gnu_cxx::is_sorted from Boost.Graph as it's lolnonportable,
implemented a version of the algorithm as a replacement,



[SVN r68144]
2011-01-14 03:02:47 +00:00
2da424d940 [boost][range] - Improved the tests by implementing outside of the boost namespace to better simulate real world usage.
[SVN r67602]
2011-01-03 01:33:04 +00:00
a5d94bbe21 [boost][range] - Make the type_erased adaptor test compatible with more compilers and reduce the time of test compilation/execution to avoid timeouts on the Intel compilers.
[SVN r67601]
2011-01-03 00:38:52 +00:00
716cf7795e [boost][range] - Fixed defect where BOOST_TEST_MESSAGE was being undefined as a side-effect by the boost/range/detail/any_iterator_buffer.hpp header file
[SVN r67542]
2011-01-01 16:51:31 +00:00
55fd3ca5b2 [boost][range] - Updated begin/end to be protected against accidental ADL to improve compatibility with C++0x. Added any_range which adds type erasure support. Added a type_erased adaptor to utilise the any_range. Implemented the any_iterator using a small buffer optimization to avoid heap usage.
[SVN r67541]
2011-01-01 16:46:32 +00:00
c506d2537f [boost][range] - Trac item 4226 - Implemented a safe_bool utility class that is intended to be refactored into a core area. Integrated this into iterator_range.
[SVN r67463]
2010-12-26 23:14:08 +00:00
efb7b50a8a [boost][range] - Improved the implementation of strided range to eliminate requirements for boost::size(rng) to be a valid expression. Each traversal category of strided_iterator is now individually implemented.
[SVN r67461]
2010-12-26 20:33:33 +00:00
fd63de33e9 [boost][range] - Correctly attribute the test case kindly contributed by Michel Morin.
[SVN r67453]
2010-12-26 14:15:23 +00:00
126 changed files with 876 additions and 294 deletions

View File

@ -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]

View File

@ -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.

View File

@ -11,7 +11,7 @@
#include <boost/range/algorithm/copy.hpp>
#include <boost/assign.hpp>
#include <algorithm>
#include <functinoal>
#include <functional>
#include <iostream>
#include <vector>

View File

@ -41,5 +41,5 @@ int main(int argc, const char* argv[])
display_element_and_index( input | indexed(0) );
return 0;
]
}

View File

@ -9,7 +9,7 @@
//
#include <boost/range/adaptor/transformed.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/assign.hpp>
#include <boost/assign.hpp>
#include <algorithm>
#include <iostream>
#include <vector>

View File

@ -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]
]

View File

@ -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]

View File

@ -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'
``

View File

@ -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]

View File

@ -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.

View File

@ -143,10 +143,6 @@ namespace boost
skip_iter(boost::end(r), boost::end(r), p))
{
}
private:
P m_pred;
R* m_range;
};
template< class T >

0
include/boost/range/adaptor/argument_fwd.hpp Executable file → Normal file
View File

0
include/boost/range/adaptor/copied.hpp Executable file → Normal file
View File

View File

@ -44,24 +44,6 @@
return range_adaptor <const Range>(rng); \
}
#define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, adaptor_class ) \
template<typename Range> range_adaptor <Range> \
operator|(Range& rng, const adaptor_name & args) \
{ \
return range_adaptor <Range>(rng, args.arg1); \
} \
template<typename Range> range_adaptor <const Range> \
operator|(const Range& rng, const adaptor_name & args) \
{ \
return range_adaptor <Range>(rng, args.arg1); \
} \
template<typename Range, typename Arg1> \
range_adaptor<Range> \
make_##adaptor_name(Range& rng, Arg1 arg1) \
{ \
return range_adaptor<Range>(rng, arg1); \
}
#define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, arg1_type ) \
struct adaptor_name \
{ \

0
include/boost/range/adaptor/filtered.hpp Executable file → Normal file
View File

0
include/boost/range/adaptor/indexed.hpp Executable file → Normal file
View File

0
include/boost/range/adaptor/map.hpp Executable file → Normal file
View File

0
include/boost/range/adaptor/reversed.hpp Executable file → Normal file
View File

0
include/boost/range/adaptor/sliced.hpp Executable file → Normal file
View File

43
include/boost/range/adaptor/strided.hpp Executable file → Normal file
View File

@ -176,6 +176,7 @@ namespace boost
strided_iterator()
: m_first()
, m_last()
, m_index(0)
, m_stride()
{
}
@ -184,6 +185,7 @@ namespace boost
: super_t(it)
, m_first(first)
, m_last(last)
, m_index(stride ? (it - first) / stride : 0)
, m_stride(stride)
{
}
@ -194,6 +196,7 @@ namespace boost
: super_t(other.base())
, m_first(other.base_begin())
, m_last(other.base_end())
, m_index(other.get_index())
, m_stride(other.get_stride())
{
}
@ -201,44 +204,37 @@ namespace boost
base_iterator base_begin() const { return m_first; }
base_iterator base_end() const { return m_last; }
difference_type get_stride() const { return m_stride; }
difference_type get_index() const { return m_index; }
private:
void increment()
{
base_iterator& it = this->base_reference();
if ((m_last - it) > m_stride)
it += m_stride;
m_index += m_stride;
if (m_index < (m_last - m_first))
this->base_reference() = m_first + m_index;
else
it = m_last;
this->base_reference() = m_last;
}
void decrement()
{
base_iterator& it = this->base_reference();
if ((it - m_first) > m_stride)
it -= m_stride;
m_index -= m_stride;
if (m_index >= 0)
this->base_reference() = m_first + m_index;
else
it = m_first;
this->base_reference() = m_first;
}
void advance(difference_type offset)
{
base_iterator& it = this->base_reference();
offset *= m_stride;
if (offset >= 0)
{
if ((m_last - it) > offset)
it += offset;
else
it = m_last;
}
m_index += offset;
if (m_index < 0)
this->base_reference() = m_first;
else if (m_index > (m_last - m_first))
this->base_reference() = m_last;
else
{
if ((m_first - it) > offset)
it += offset;
else
it = m_first;
}
this->base_reference() = m_first + m_index;
}
template<class OtherIterator>
@ -252,12 +248,13 @@ namespace boost
bool equal(const strided_iterator& other) const
{
return other.base() == this->base();
return this->base() == other.base();
}
private:
base_iterator m_first;
base_iterator m_last;
difference_type m_index;
difference_type m_stride;
};

0
include/boost/range/adaptor/tokenized.hpp Executable file → Normal file
View File

4
include/boost/range/adaptor/transformed.hpp Executable file → Normal file
View File

@ -42,8 +42,8 @@ namespace boost
typedef R source_range_type;
transformed_range( F f, R& r )
: base( make_transform_iterator( boost::begin(r), f ),
make_transform_iterator( boost::end(r), f ) )
: base( boost::make_transform_iterator( boost::begin(r), f ),
boost::make_transform_iterator( boost::end(r), f ) )
{ }
};

0
include/boost/range/adaptor/uniqued.hpp Executable file → Normal file
View File

0
include/boost/range/adaptors.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/adjacent_find.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/binary_search.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/copy_backward.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/count.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/count_if.hpp Executable file → Normal file
View File

20
include/boost/range/algorithm/equal.hpp Executable file → Normal file
View 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

0
include/boost/range/algorithm/equal_range.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/fill.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/fill_n.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/find.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/find_end.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/find_first_of.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/find_if.hpp Executable file → Normal file
View File

65
include/boost/range/algorithm/for_each.hpp Executable file → Normal file
View File

@ -13,13 +13,52 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/ref.hpp>
#include <algorithm>
#if BOOST_WORKAROUND(BOOST_MSVC, == 1600)
#include <xutility>
#endif
namespace boost
{
namespace range
{
#if BOOST_WORKAROUND(BOOST_MSVC, == 1600)
namespace for_each_detail
{
template<typename Iterator, typename UnaryFunction>
inline UnaryFunction
for_each_impl(Iterator first, Iterator last, UnaryFunction fun,
typename enable_if<
is_reference_wrapper<UnaryFunction>,
void
>::type* = 0)
{
typedef typename std::_Get_unchecked_type<Iterator>::type
unchecked_iterator;
unchecked_iterator unchecked_last = std::_Unchecked(last);
for (unchecked_iterator unchecked_first = std::_Unchecked(first); first != last; ++first)
fun.get()(*unchecked_first);
return fun;
}
template<typename Iterator, typename UnaryFunction>
inline UnaryFunction
for_each_impl(Iterator first, Iterator last, UnaryFunction fn,
typename disable_if<
is_reference_wrapper<UnaryFunction>,
void
>::type* = 0)
{
return std::for_each<Iterator, UnaryFunction>(first, last, fn);
}
}
#endif
/// \brief template function for_each
///
/// range-based version of the for_each std algorithm
@ -30,7 +69,18 @@ template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(SinglePassRange & rng, UnaryFunction fun)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
return std::for_each(boost::begin(rng),boost::end(rng),fun);
#if BOOST_WORKAROUND(BOOST_MSVC, == 1600)
return for_each_detail::for_each_impl<
typename range_iterator<SinglePassRange>::type,
UnaryFunction
>(boost::begin(rng), boost::end(rng), fun);
#else
return std::for_each<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type,
UnaryFunction
>(boost::begin(rng),boost::end(rng),fun);
#endif
}
/// \overload
@ -38,7 +88,18 @@ template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(const SinglePassRange& rng, UnaryFunction fun)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::for_each(boost::begin(rng), boost::end(rng), fun);
#if BOOST_WORKAROUND(BOOST_MSVC, == 1600)
return for_each_detail::for_each_impl<
typename range_iterator<const SinglePassRange>::type,
UnaryFunction
>(boost::begin(rng), boost::end(rng), fun);
#else
return std::for_each<
BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type,
UnaryFunction
>(boost::begin(rng), boost::end(rng), fun);
#endif
}
} // namespace range

0
include/boost/range/algorithm/generate.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/heap_algorithm.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/inplace_merge.hpp Executable file → Normal file
View File

View File

0
include/boost/range/algorithm/lower_bound.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/max_element.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/merge.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/min_element.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/mismatch.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/nth_element.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/partial_sort.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/partial_sort_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/partition.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/permutation.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/random_shuffle.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/remove.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/remove_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/remove_copy_if.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/remove_if.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/replace.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/replace_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/replace_copy_if.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/replace_if.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/reverse.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/reverse_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/rotate.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/rotate_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/search.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/search_n.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/set_algorithm.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/sort.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/stable_partition.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/stable_sort.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/swap_ranges.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/transform.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/unique.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/unique_copy.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm/upper_bound.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm_ext.hpp Executable file → Normal file
View File

8
include/boost/range/algorithm_ext/copy_n.hpp Executable file → Normal file
View 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

0
include/boost/range/algorithm_ext/erase.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm_ext/for_each.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm_ext/insert.hpp Executable file → Normal file
View File

42
include/boost/range/algorithm_ext/is_sorted.hpp Executable file → Normal file
View File

@ -1,3 +1,4 @@
// Copyright Bryce Lelbach 2010
// 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
@ -14,45 +15,26 @@
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/value_type.hpp>
#include <boost/detail/is_sorted.hpp>
#include <algorithm>
namespace boost
{
namespace range_detail
{
template<class ForwardIterator>
inline bool is_sorted(ForwardIterator first, ForwardIterator last)
{
for (ForwardIterator next = first; first != last && ++next != last; ++first)
if (*next < *first)
return false;
return true;
}
template<class ForwardIterator, class BinaryPredicate>
inline bool is_sorted(ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
{
for (ForwardIterator next = first; first != last && ++next != last; ++first)
if (pred(*next, *first))
return false;
return true;
}
}
namespace range
{
/// \brief template function count
/// \brief template function is_sorted
///
/// range-based version of the count std algorithm
/// range-based version of the is_sorted std algorithm
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
template<class SinglePassRange>
inline bool is_sorted(const SinglePassRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return range_detail::is_sorted(boost::begin(rng), boost::end(rng));
BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME
range_value<const SinglePassRange>::type>));
return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng));
}
/// \overload
@ -60,12 +42,16 @@ template<class SinglePassRange, class BinaryPredicate>
inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return range_detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type,
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
}
} // namespace range
using range::is_sorted;
using range::is_sorted;
} // namespace boost
#endif // include guard

0
include/boost/range/algorithm_ext/overwrite.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm_ext/push_back.hpp Executable file → Normal file
View File

0
include/boost/range/algorithm_ext/push_front.hpp Executable file → Normal file
View File

View File

@ -15,6 +15,7 @@
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/range/detail/any_iterator.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/reference.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/iterator_range_core.hpp>

View File

@ -74,7 +74,7 @@ namespace boost
#endif
template< class T >
inline long is_char_ptr( T /* r */ )
inline long is_char_ptr( const T& /* r */ )
{
return 0L;
}

0
include/boost/range/combine.hpp Executable file → Normal file
View File

1
include/boost/range/counting_range.hpp Executable file → Normal file
View File

@ -18,7 +18,6 @@
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/value_type.hpp>
#include <boost/iterator/counting_iterator.hpp>
#include <boost/utility.hpp>
namespace boost
{

View File

@ -11,7 +11,6 @@
#define BOOST_RANGE_DETAIL_ANY_ITERATOR_HPP_INCLUDED
#include <boost/cast.hpp>
#include <boost/utility.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/not.hpp>

View File

@ -13,7 +13,7 @@
#include <boost/array.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility.hpp>
#include <boost/noncopyable.hpp>
namespace boost
{

View File

@ -5,6 +5,9 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Acknowledgements:
// aschoedl supplied a fix to supply the level of interoperability I had
// originally intended, but failed to implement.
//
// For more information, see http://www.boost.org/libs/range/
//
@ -19,12 +22,12 @@ namespace boost
{
template<class IteratorTraversalTag1, class IteratorTraversalTag2>
struct demote_iterator_traversal_tag
struct inner_demote_iterator_traversal_tag
{
};
#define BOOST_DEMOTE_TRAVERSAL_TAG( Tag1, Tag2, ResultTag ) \
template<> struct demote_iterator_traversal_tag< Tag1 , Tag2 > \
template<> struct inner_demote_iterator_traversal_tag< Tag1 , Tag2 > \
{ \
typedef ResultTag type; \
};
@ -73,6 +76,15 @@ BOOST_DEMOTE_TRAVERSAL_TAG( random_access_traversal_tag, random_access_traversal
#undef BOOST_DEMOTE_TRAVERSAL_TAG
template<class IteratorTraversalTag1, class IteratorTraversalTag2>
struct demote_iterator_traversal_tag
: inner_demote_iterator_traversal_tag<
typename boost::detail::pure_traversal_tag< IteratorTraversalTag1 >::type,
typename boost::detail::pure_traversal_tag< IteratorTraversalTag2 >::type
>
{
};
} // namespace range_detail
} // namespace boost

View File

@ -134,8 +134,8 @@ namespace boost
#include <boost/range/detail/begin.hpp>
#include <boost/range/detail/end.hpp>
#include <boost/range/detail/size_type>
#include <boost/range/detail/value_type>
#include <boost/range/detail/size_type.hpp>
#include <boost/range/detail/value_type.hpp>
#include <boost/range/detail/common.hpp>
namespace boost

0
include/boost/range/detail/extract_optional_type.hpp Executable file → Normal file
View File

View File

@ -5,6 +5,9 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Acknowledgements:
// aschoedl contributed an improvement to the determination
// of the Reference type parameter.
//
// For more information, see http://www.boost.org/libs/range/
//
@ -20,7 +23,7 @@
#include <boost/range/empty.hpp>
#include <boost/range/detail/demote_iterator_traversal_tag.hpp>
#include <boost/range/value_type.hpp>
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
namespace boost
{
@ -120,7 +123,32 @@ private:
template<typename Iterator1
, typename Iterator2
, typename ValueType = typename iterator_value<Iterator1>::type
, typename Reference = typename iterator_reference<Iterator1>::type
// find least demanding, commonly supported reference type, in the order &, const&, and by-value:
, typename Reference = typename mpl::if_c<
!is_reference<typename iterator_reference<Iterator1>::type>::value
|| !is_reference<typename iterator_reference<Iterator2>::type>::value,
typename remove_const<
typename remove_reference<
typename iterator_reference<Iterator1>::type
>::type
>::type,
typename mpl::if_c<
is_const<
typename remove_reference<
typename iterator_reference<Iterator1>::type
>::type
>::value
|| is_const<
typename remove_reference<
typename iterator_reference<Iterator2>::type
>::type
>::value,
typename add_const<
typename iterator_reference<Iterator2>::type
>::type,
typename iterator_reference<Iterator1>::type
>::type
>::type
, typename Traversal = typename demote_iterator_traversal_tag<
typename iterator_traversal<Iterator1>::type
, typename iterator_traversal<Iterator2>::type>::type

0
include/boost/range/detail/misc_concept.hpp Executable file → Normal file
View File

0
include/boost/range/detail/range_return.hpp Executable file → Normal file
View File

View 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;
};
}

View File

@ -13,13 +13,13 @@
#include <boost/mpl/bool.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/range/iterator.hpp>
#include <boost/utility.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost
{
namespace range_detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(type);
BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
template<class T, class Enabler = void>
struct has_range_iterator_impl

Some files were not shown because too many files have changed in this diff Show More