1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/range/size.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,123 @@
1.4 +// Boost.Range library
1.5 +//
1.6 +// Copyright Thorsten Ottosen 2003-2004. Use, modification and
1.7 +// distribution is subject to the Boost Software License, Version
1.8 +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.9 +// http://www.boost.org/LICENSE_1_0.txt)
1.10 +//
1.11 +// For more information, see http://www.boost.org/libs/range/
1.12 +//
1.13 +
1.14 +#ifndef BOOST_RANGE_SIZE_HPP
1.15 +#define BOOST_RANGE_SIZE_HPP
1.16 +
1.17 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
1.18 +# pragma once
1.19 +#endif
1.20 +
1.21 +#include <boost/range/config.hpp>
1.22 +
1.23 +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1.24 +#include <boost/range/detail/size.hpp>
1.25 +#else
1.26 +
1.27 +#include <boost/range/detail/implementation_help.hpp>
1.28 +#include <boost/range/size_type.hpp>
1.29 +#include <cstddef>
1.30 +#include <iterator>
1.31 +#include <utility>
1.32 +
1.33 +namespace boost
1.34 +{
1.35 +
1.36 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.37 +namespace range_detail
1.38 +{
1.39 +#endif
1.40 + //////////////////////////////////////////////////////////////////////
1.41 + // primary template
1.42 + //////////////////////////////////////////////////////////////////////
1.43 +
1.44 + template< typename C >
1.45 + inline BOOST_DEDUCED_TYPENAME C::size_type
1.46 + boost_range_size( const C& c )
1.47 + {
1.48 + return c.size();
1.49 + }
1.50 +
1.51 + //////////////////////////////////////////////////////////////////////
1.52 + // pair
1.53 + //////////////////////////////////////////////////////////////////////
1.54 +
1.55 + template< typename Iterator >
1.56 + inline std::size_t boost_range_size( const std::pair<Iterator,Iterator>& p )
1.57 + {
1.58 + return std::distance( p.first, p.second );
1.59 + }
1.60 +
1.61 + //////////////////////////////////////////////////////////////////////
1.62 + // array
1.63 + //////////////////////////////////////////////////////////////////////
1.64 +
1.65 + template< typename T, std::size_t sz >
1.66 + inline std::size_t boost_range_size( const T (&array)[sz] )
1.67 + {
1.68 + return range_detail::array_size<T,sz>( array );
1.69 + }
1.70 +
1.71 + template< typename T, std::size_t sz >
1.72 + inline std::size_t boost_range_size( T (&array)[sz] )
1.73 + {
1.74 + return boost::range_detail::array_size<T,sz>( array );
1.75 + }
1.76 +
1.77 + //////////////////////////////////////////////////////////////////////
1.78 + // string
1.79 + //////////////////////////////////////////////////////////////////////
1.80 +
1.81 + inline std::size_t boost_range_size( const char* const& s )
1.82 + {
1.83 + return boost::range_detail::str_size( s );
1.84 + }
1.85 +
1.86 + inline std::size_t boost_range_size( const wchar_t* const& s )
1.87 + {
1.88 + return boost::range_detail::str_size( s );
1.89 + }
1.90 +
1.91 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.92 +} // namespace 'range_detail'
1.93 +#endif
1.94 +
1.95 +template< class T >
1.96 +inline BOOST_DEDUCED_TYPENAME range_size<T>::type size( const T& r )
1.97 +{
1.98 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.99 + using namespace range_detail;
1.100 +#endif
1.101 + return boost_range_size( r );
1.102 +}
1.103 +
1.104 +
1.105 +#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.106 +// BCB and CW are not able to overload pointer when class overloads are also available.
1.107 +inline range_size<const char*>::type size( const char* r ) {
1.108 + return range_detail::str_size( r );
1.109 +}
1.110 +inline range_size<char*>::type size( char* r ) {
1.111 + return range_detail::str_size( r );
1.112 +}
1.113 +inline range_size<const wchar_t*>::type size( const wchar_t* r ) {
1.114 + return range_detail::str_size( r );
1.115 +}
1.116 +inline range_size<wchar_t*>::type size( wchar_t* r ) {
1.117 + return range_detail::str_size( r );
1.118 +}
1.119 +#endif
1.120 +
1.121 +
1.122 +} // namespace 'boost'
1.123 +
1.124 +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1.125 +
1.126 +#endif