forked from boostorg/range
*** empty log message ***
[SVN r26630]
This commit is contained in:
@ -142,7 +142,7 @@ inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type begin( const T& r )
|
|||||||
return range_detail::begin( r );
|
return range_detail::begin( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, <= 3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||||
// BCB and CW are not able to overload pointer when class overloads are also available.
|
// BCB and CW are not able to overload pointer when class overloads are also available.
|
||||||
template<>
|
template<>
|
||||||
inline range_const_iterator<const char*>::type begin<const char*>( const char*& r )
|
inline range_const_iterator<const char*>::type begin<const char*>( const char*& r )
|
||||||
|
@ -96,6 +96,30 @@ namespace boost
|
|||||||
typedef const wchar_t* type;
|
typedef const wchar_t* type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator< char* const >
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator< wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator< const char* const >
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator< const wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
@ -100,6 +100,30 @@ namespace boost
|
|||||||
typedef std::ptrdiff_t type;
|
typedef std::ptrdiff_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference< char* const >
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference< wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference< const char* const >
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference< const wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
@ -143,7 +143,7 @@ inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type end( const T& r )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, <= 3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||||
// BCB and CW are not able to overload pointer when class overloads are also available.
|
// BCB and CW are not able to overload pointer when class overloads are also available.
|
||||||
template<>
|
template<>
|
||||||
inline range_const_iterator<const char*>::type end<const char*>( const char*& r )
|
inline range_const_iterator<const char*>::type end<const char*>( const char*& r )
|
||||||
|
@ -97,6 +97,30 @@ namespace boost
|
|||||||
typedef const wchar_t* type;
|
typedef const wchar_t* type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator< char* const >
|
||||||
|
{
|
||||||
|
typedef char* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator< wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef wchar_t* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator< const char* const >
|
||||||
|
{
|
||||||
|
typedef const char* type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator< const wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef const wchar_t* type;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
@ -152,28 +152,16 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! begin access
|
|
||||||
/*!
|
|
||||||
Retrieve the begin iterator
|
|
||||||
*/
|
|
||||||
IteratorT begin() const
|
IteratorT begin() const
|
||||||
{
|
{
|
||||||
return m_Begin;
|
return m_Begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! end access
|
|
||||||
/*!
|
|
||||||
Retrieve the end iterator
|
|
||||||
*/
|
|
||||||
IteratorT end() const
|
IteratorT end() const
|
||||||
{
|
{
|
||||||
return m_End;
|
return m_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Size of the range
|
|
||||||
/*!
|
|
||||||
Retrieve the size of the range
|
|
||||||
*/
|
|
||||||
size_type size() const
|
size_type size() const
|
||||||
{
|
{
|
||||||
if( singular )
|
if( singular )
|
||||||
@ -190,18 +178,6 @@ namespace boost {
|
|||||||
return m_Begin == m_End;
|
return m_Begin == m_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Safe bool conversion
|
|
||||||
/*!
|
|
||||||
Check whenever the range is empty.
|
|
||||||
Allows to use construction like this:
|
|
||||||
\code
|
|
||||||
iterator_range r;
|
|
||||||
if (!r)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
\endcode
|
|
||||||
*/
|
|
||||||
typedef iterator (iterator_range::*unspecified_bool_type) () const;
|
typedef iterator (iterator_range::*unspecified_bool_type) () const;
|
||||||
operator unspecified_bool_type() const
|
operator unspecified_bool_type() const
|
||||||
{
|
{
|
||||||
@ -213,6 +189,7 @@ namespace boost {
|
|||||||
return singular == r.singular && m_Begin == r.m_Begin && m_End == r.m_End;
|
return singular == r.singular && m_Begin == r.m_Begin && m_End == r.m_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
bool operator==( const iterator_range& r ) const
|
bool operator==( const iterator_range& r ) const
|
||||||
@ -232,6 +209,61 @@ namespace boost {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public: // convenience
|
||||||
|
value_type& front() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *m_Begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& back() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *--m_End;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& operator[]( size_type sz ) const
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
BOOST_ASSERT( sz < size() );
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& at( size_type sz ) const
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
if( sz < size() )
|
||||||
|
throw "foo";
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
void advance( size_type sz )
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( sz <= size() );
|
||||||
|
std::advance( m_Begin, sz );
|
||||||
|
}
|
||||||
|
|
||||||
|
void narrow( size_type left, size_type right )
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( left + right <= size() );
|
||||||
|
std::advance( m_Begin, left );
|
||||||
|
std::advance( m_End, -right );
|
||||||
|
}
|
||||||
|
|
||||||
|
public: // iterable
|
||||||
|
iterator_range& operator++()
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
++m_End;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& operator*() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return front();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template< class ForwardRange >
|
template< class ForwardRange >
|
||||||
iterator adl_begin( ForwardRange& r )
|
iterator adl_begin( ForwardRange& r )
|
||||||
|
@ -92,7 +92,7 @@ inline BOOST_DEDUCED_TYPENAME range_size<T>::type size( const T& r )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, <= 3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||||
// BCB and CW are not able to overload pointer when class overloads are also available.
|
// BCB and CW are not able to overload pointer when class overloads are also available.
|
||||||
inline range_size<const char*>::type size( const char* r ) {
|
inline range_size<const char*>::type size( const char* r ) {
|
||||||
return range_detail::str_size( r );
|
return range_detail::str_size( r );
|
||||||
|
@ -96,6 +96,30 @@ namespace boost
|
|||||||
typedef std::size_t type;
|
typedef std::size_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size< char* const >
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size< wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size< const char* const >
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size< const wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
@ -85,6 +85,74 @@ namespace boost
|
|||||||
const_iterator end() const { return base::end(); }
|
const_iterator end() const { return base::end(); }
|
||||||
size_type size() const { return base::size(); }
|
size_type size() const { return base::size(); }
|
||||||
|
|
||||||
|
|
||||||
|
public: // convenience
|
||||||
|
value_type& front()
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *m_Begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value_type& front() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *m_Begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& back()
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *--m_End;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value_type& back() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return *--m_End;
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& operator[]( size_type sz )
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
BOOST_ASSERT( sz < size() );
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
const value_type& operator[]( size_type sz ) const
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
BOOST_ASSERT( sz < size() );
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
value_type& at( size_type sz )
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
if( sz < size() )
|
||||||
|
throw "foo";
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
const value_type& at( size_type sz ) const
|
||||||
|
{
|
||||||
|
//BOOST_STATIC_ASSERT( is_random_access );
|
||||||
|
if( sz < size() )
|
||||||
|
throw "foo";
|
||||||
|
return m_Begin[sz];
|
||||||
|
}
|
||||||
|
|
||||||
|
public: // iterable
|
||||||
|
value_type& operator*()
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return front();
|
||||||
|
}
|
||||||
|
|
||||||
|
const value_type& operator*() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT( !empty() );
|
||||||
|
return front();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template< class ForwardRange, class ForwardRange2 >
|
template< class ForwardRange, class ForwardRange2 >
|
||||||
|
@ -101,6 +101,30 @@ namespace boost
|
|||||||
typedef const wchar_t type;
|
typedef const wchar_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value< char* const >
|
||||||
|
{
|
||||||
|
typedef char type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value< wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef wchar_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value< const char* const >
|
||||||
|
{
|
||||||
|
typedef const char type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value< const wchar_t* const >
|
||||||
|
{
|
||||||
|
typedef const wchar_t type;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
Reference in New Issue
Block a user