*** empty log message ***

[SVN r24385]
This commit is contained in:
Thorsten Jørgen Ottosen
2004-08-10 16:09:30 +00:00
parent 0dbf587323
commit ebca0b2a2a
5 changed files with 62 additions and 46 deletions

View File

@ -16,7 +16,7 @@
#endif #endif
#include <boost/range/functions.hpp> #include <boost/range/functions.hpp>
#include <boost/range/types.hpp> #include <boost/range/metafunctions.hpp>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>
#include <boost/range/sub_range.hpp> #include <boost/range/sub_range.hpp>

View File

@ -85,26 +85,26 @@ namespace boost {
//! Constructor from a Range //! Constructor from a Range
template< class Range > template< class Range >
iterator_range( const Range& r ) : iterator_range( const Range& r ) :
m_Begin( begin_impl( r ) ), m_End( end_impl( r ) ) {} m_Begin( boost::begin( r ) ), m_End( boost::end( r ) ) {}
//! Constructor from a Range //! Constructor from a Range
template< class Range > template< class Range >
iterator_range( Range& r ) : iterator_range( Range& r ) :
m_Begin( begin_impl( r ) ), m_End( end_impl( r ) ) {} m_Begin( boost::begin( r ) ), m_End( boost::end( r ) ) {}
template< class ForwardRange > template< class ForwardRange >
iterator_range& operator=( ForwardRange& r ) iterator_range& operator=( ForwardRange& r )
{ {
m_Begin = begin_impl( r ); m_Begin = boost::begin( r );
m_End = end_impl( r ); m_End = boost::end( r );
return *this; return *this;
} }
template< class ForwardRange > template< class ForwardRange >
iterator_range& operator=( const ForwardRange& r ) iterator_range& operator=( const ForwardRange& r )
{ {
m_Begin = begin_impl( r ); m_Begin = boost::begin( r );
m_End = end_impl( r ); m_End = boost::end( r );
return *this; return *this;
} }
@ -163,29 +163,6 @@ namespace boost {
IteratorT m_Begin; IteratorT m_Begin;
IteratorT m_End; IteratorT m_End;
private:
template< class ForwardRange >
iterator end_impl( ForwardRange& r ) const
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
using boost::end;
return end( r );
#else
return boost::end( r );
#endif
}
template< class ForwardRange >
iterator begin_impl( ForwardRange& r ) const
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
using boost::begin;
return begin( r );
#else
return boost::begin( r );
#endif
}
}; };
// iterator range free-standing operators ---------------------------// // iterator range free-standing operators ---------------------------//

View File

@ -0,0 +1,28 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_METAFUNCTIONS_HPP
#define BOOST_RANGE_METAFUNCTIONS_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/size_type.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/reverse_iterator.hpp>
#include <boost/range/const_reverse_iterator.hpp>
#include <boost/range/reverse_result_iterator.hpp>
#endif

View File

@ -22,16 +22,18 @@
#else #else
#include <boost/range/detail/implementation_help.hpp> #include <boost/range/detail/implementation_help.hpp>
#include <boost/range/size_type.hpp>
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
#include <utility> #include <utility>
namespace boost { namespace boost
{
namespace range namespace range
{ {
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// default // primary template
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
template< typename C > template< typename C >
@ -83,7 +85,16 @@ namespace range
} // namespace 'range' } // namespace 'range'
using range::size; template< class T >
inline BOOST_DEDUCED_TYPENAME size_type_of<T>::type size( const T& r )
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
using range::size;
return size( r );
#else
return range::size( r );
#endif
}
} // namespace 'boost' } // namespace 'boost'

View File

@ -20,28 +20,28 @@
namespace boost namespace boost
{ {
template< class XRange > template< class ForwardRange >
class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of<XRange>::type > class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of<ForwardRange>::type >
{ {
sub_range(); // not implemented sub_range(); // not implemented
typedef BOOST_DEDUCED_TYPENAME result_iterator_of<XRange>::type iterator_t; typedef BOOST_DEDUCED_TYPENAME result_iterator_of<ForwardRange>::type iterator_t;
typedef iterator_range< iterator_t > base; typedef iterator_range< iterator_t > base;
public: public:
using base::iterator; using base::iterator;
using base::const_iterator; using base::const_iterator;
using base::value_type; using base::value_type;
typedef BOOST_DEDUCED_TYPENAME difference_type_of<XRange>::type difference_type; typedef BOOST_DEDUCED_TYPENAME difference_type_of<ForwardRange>::type difference_type;
typedef BOOST_DEDUCED_TYPENAME size_type_of<XRange>::type size_type; typedef BOOST_DEDUCED_TYPENAME size_type_of<ForwardRange>::type size_type;
public: public:
template< class XRange2 > template< class ForwardRange2 >
sub_range( XRange2& r ) : base( r ) sub_range( ForwardRange2& r ) : base( r )
{ } { }
template< class XRange2 > template< class ForwardRange2 >
sub_range( const XRange2& r ) : base( r ) sub_range( const ForwardRange2& r ) : base( r )
{ } { }
template< class Iter > template< class Iter >
@ -49,15 +49,15 @@ namespace boost
base( first, last ) base( first, last )
{ } { }
template< class XRange2 > template< class ForwardRange2 >
sub_range& operator=( XRange2& r ) sub_range& operator=( ForwardRange2& r )
{ {
base::operator=( r ); base::operator=( r );
return *this; return *this;
} }
template< class XRange2 > template< class ForwardRange2 >
sub_range& operator=( const XRange2& r ) sub_range& operator=( const ForwardRange2& r )
{ {
base::operator=( r ); base::operator=( r );
return *this; return *this;