From ebca0b2a2a07b0adb6f707205385a56b04d10aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 10 Aug 2004 16:09:30 +0000 Subject: [PATCH] *** empty log message *** [SVN r24385] --- include/boost/range.hpp | 2 +- include/boost/range/iterator_range.hpp | 35 +++++--------------------- include/boost/range/metafunctions.hpp | 28 +++++++++++++++++++++ include/boost/range/size.hpp | 17 ++++++++++--- include/boost/range/sub_range.hpp | 26 +++++++++---------- 5 files changed, 62 insertions(+), 46 deletions(-) create mode 100755 include/boost/range/metafunctions.hpp diff --git a/include/boost/range.hpp b/include/boost/range.hpp index 88edcf5..2aeb393 100755 --- a/include/boost/range.hpp +++ b/include/boost/range.hpp @@ -16,7 +16,7 @@ #endif #include -#include +#include #include #include diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp index 3e53f15..c6fa806 100755 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -85,26 +85,26 @@ namespace boost { //! Constructor from a Range template< class Range > 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 template< class Range > 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 > iterator_range& operator=( ForwardRange& r ) { - m_Begin = begin_impl( r ); - m_End = end_impl( r ); + m_Begin = boost::begin( r ); + m_End = boost::end( r ); return *this; } template< class ForwardRange > iterator_range& operator=( const ForwardRange& r ) { - m_Begin = begin_impl( r ); - m_End = end_impl( r ); + m_Begin = boost::begin( r ); + m_End = boost::end( r ); return *this; } @@ -163,29 +163,6 @@ namespace boost { IteratorT m_Begin; 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 ---------------------------// diff --git a/include/boost/range/metafunctions.hpp b/include/boost/range/metafunctions.hpp new file mode 100755 index 0000000..3bf899f --- /dev/null +++ b/include/boost/range/metafunctions.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/range/size.hpp b/include/boost/range/size.hpp index 2db5261..05ec975 100755 --- a/include/boost/range/size.hpp +++ b/include/boost/range/size.hpp @@ -22,16 +22,18 @@ #else #include +#include #include #include #include -namespace boost { +namespace boost +{ namespace range { ////////////////////////////////////////////////////////////////////// - // default + // primary template ////////////////////////////////////////////////////////////////////// template< typename C > @@ -83,7 +85,16 @@ namespace range } // namespace 'range' -using range::size; +template< class T > +inline BOOST_DEDUCED_TYPENAME size_type_of::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' diff --git a/include/boost/range/sub_range.hpp b/include/boost/range/sub_range.hpp index 1de309f..b21aeb8 100755 --- a/include/boost/range/sub_range.hpp +++ b/include/boost/range/sub_range.hpp @@ -20,28 +20,28 @@ namespace boost { - template< class XRange > - class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of::type > + template< class ForwardRange > + class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME result_iterator_of::type > { sub_range(); // not implemented - typedef BOOST_DEDUCED_TYPENAME result_iterator_of::type iterator_t; + typedef BOOST_DEDUCED_TYPENAME result_iterator_of::type iterator_t; typedef iterator_range< iterator_t > base; public: using base::iterator; using base::const_iterator; using base::value_type; - typedef BOOST_DEDUCED_TYPENAME difference_type_of::type difference_type; - typedef BOOST_DEDUCED_TYPENAME size_type_of::type size_type; + typedef BOOST_DEDUCED_TYPENAME difference_type_of::type difference_type; + typedef BOOST_DEDUCED_TYPENAME size_type_of::type size_type; public: - template< class XRange2 > - sub_range( XRange2& r ) : base( r ) + template< class ForwardRange2 > + sub_range( ForwardRange2& r ) : base( r ) { } - template< class XRange2 > - sub_range( const XRange2& r ) : base( r ) + template< class ForwardRange2 > + sub_range( const ForwardRange2& r ) : base( r ) { } template< class Iter > @@ -49,15 +49,15 @@ namespace boost base( first, last ) { } - template< class XRange2 > - sub_range& operator=( XRange2& r ) + template< class ForwardRange2 > + sub_range& operator=( ForwardRange2& r ) { base::operator=( r ); return *this; } - template< class XRange2 > - sub_range& operator=( const XRange2& r ) + template< class ForwardRange2 > + sub_range& operator=( const ForwardRange2& r ) { base::operator=( r ); return *this;