mirror of
https://github.com/boostorg/range.git
synced 2026-04-29 02:24:12 +02:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 024414f660 | |||
| 2f3d82be9f | |||
| 47e478d099 | |||
| cafea6aea5 | |||
| 6d46ce412f | |||
| 674be9dfa0 | |||
| 65b22bfa38 | |||
| fb8994f51c | |||
| 26c095d022 | |||
| ca2328ed87 | |||
| 794fd3e226 | |||
| 88001ada37 | |||
| 91d62c2c1a | |||
| f9eeb5d447 | |||
| a47f15a98f | |||
| dfc30e334d | |||
| 13b748a228 | |||
| eea32403ef | |||
| 29b2053f5c | |||
| 29fa877949 | |||
| a39946c55d | |||
| 90f4eca5cd | |||
| c8c808b04e | |||
| deefb61ec6 | |||
| 12d904a5e4 | |||
| 26b096f65d | |||
| a85afbe470 | |||
| e7902d439b | |||
| b4f99d66b5 | |||
| d1c2c5ce3f | |||
| 062e820882 | |||
| 4d381e8564 | |||
| fd00cc129f | |||
| 8291ce67fc | |||
| dbfa1df088 | |||
| 5afec2b74f | |||
| a33d5c22c5 | |||
| 901266b76a | |||
| 25e932149c | |||
| c54e15d374 | |||
| fd448ffa31 | |||
| 21b558fe5e | |||
| 33c8f3e3ec | |||
| 523f8a5926 | |||
| 3bd0d886c4 | |||
| e46eae8144 | |||
| 12cf02586c | |||
| ee024f588b | |||
| 8e715b3810 |
@@ -11,7 +11,7 @@
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
#include <boost/assign.hpp>
|
||||
#include <algorithm>
|
||||
#include <functinoal>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -41,5 +41,5 @@ int main(int argc, const char* argv[])
|
||||
display_element_and_index( input | indexed(0) );
|
||||
|
||||
return 0;
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1300)
|
||||
#if _MSC_VER == 1300 // experiment
|
||||
|
||||
#include <boost/range/detail/collection_traits.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
@@ -28,6 +28,6 @@
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/sub_range.hpp>
|
||||
|
||||
#endif // _MSC_VER == 1300
|
||||
#endif // _MSC_VER == 1300 // experiment
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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 >
|
||||
|
||||
Executable → Regular
Executable → Regular
@@ -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 \
|
||||
{ \
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+20
-23
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -25,7 +25,7 @@
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar>
|
||||
#endif
|
||||
|
||||
@@ -38,41 +38,41 @@ namespace boost
|
||||
return strlen( s );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline std::size_t length( const wchar_t* s )
|
||||
{
|
||||
return wcslen( s );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Remark: the compiler cannot choose between T* and T[sz]
|
||||
// overloads, so we must put the T* internal to the
|
||||
// unconstrained version.
|
||||
//
|
||||
//
|
||||
|
||||
inline bool is_char_ptr( char* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline bool is_char_ptr( const char* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline bool is_char_ptr( wchar_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline bool is_char_ptr( const wchar_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template< class T >
|
||||
inline long is_char_ptr( T /* r */ )
|
||||
{
|
||||
@@ -80,30 +80,30 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline iterator_range<T*>
|
||||
inline iterator_range<T*>
|
||||
make_range( T* const r, bool )
|
||||
{
|
||||
return iterator_range<T*>( r, r + length(r) );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
|
||||
make_range( T& r, long )
|
||||
{
|
||||
return boost::make_iterator_range( r );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
|
||||
as_literal( Range& r )
|
||||
{
|
||||
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
|
||||
}
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
|
||||
as_literal( const Range& r )
|
||||
{
|
||||
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
|
||||
@@ -112,9 +112,9 @@ namespace boost
|
||||
template< class Char, std::size_t sz >
|
||||
inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
|
||||
{
|
||||
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
|
||||
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
|
||||
}
|
||||
|
||||
|
||||
template< class Char, std::size_t sz >
|
||||
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
|
||||
{
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+7
-7
@@ -21,13 +21,13 @@
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template <typename T>
|
||||
inline void boost_range_silence_warning( const T& ) { }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// end() help
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -36,7 +36,7 @@ namespace boost
|
||||
{
|
||||
return s + strlen( s );
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace boost
|
||||
;
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template< class Char >
|
||||
inline Char* str_end( Char* s )
|
||||
@@ -64,7 +64,7 @@ namespace boost
|
||||
{
|
||||
return boost_range_array + sz;
|
||||
}
|
||||
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace boost
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// size() help
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template< class Char >
|
||||
inline std::size_t str_size( const Char* const& s )
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace boost
|
||||
}
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user