epoc32/include/stdapis/boost/range/begin.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/range/begin.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,197 @@
     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_BEGIN_HPP
    1.15 +#define BOOST_RANGE_BEGIN_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/type_traits/remove_const.hpp>
    1.22 +#include <boost/range/config.hpp>
    1.23 +
    1.24 +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
    1.25 +#include <boost/range/detail/begin.hpp>
    1.26 +#else
    1.27 +
    1.28 +#include <boost/range/iterator.hpp>
    1.29 +#include <boost/range/const_iterator.hpp>
    1.30 +
    1.31 +namespace boost
    1.32 +{
    1.33 +
    1.34 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
    1.35 +    !BOOST_WORKAROUND(__GNUC__, < 3) \
    1.36 +    /**/
    1.37 +namespace range_detail
    1.38 +{
    1.39 +#endif
    1.40 +
    1.41 +    //////////////////////////////////////////////////////////////////////
    1.42 +    // primary template
    1.43 +    //////////////////////////////////////////////////////////////////////
    1.44 +
    1.45 +    template< typename C >
    1.46 +    inline BOOST_DEDUCED_TYPENAME range_const_iterator<C>::type
    1.47 +    boost_range_begin( const C& c )
    1.48 +    {
    1.49 +        return c.begin();
    1.50 +    }
    1.51 +
    1.52 +    template< typename C >
    1.53 +    inline BOOST_DEDUCED_TYPENAME range_iterator<
    1.54 +                                                                        typename remove_const<C>::type >::type
    1.55 +    boost_range_begin( C& c )
    1.56 +    {
    1.57 +        return c.begin();
    1.58 +    }
    1.59 +
    1.60 +    //////////////////////////////////////////////////////////////////////
    1.61 +    // pair
    1.62 +    //////////////////////////////////////////////////////////////////////
    1.63 +
    1.64 +    template< typename Iterator >
    1.65 +    inline Iterator boost_range_begin( const std::pair<Iterator,Iterator>& p )
    1.66 +    {
    1.67 +        return p.first;
    1.68 +    }
    1.69 +
    1.70 +    template< typename Iterator >
    1.71 +    inline Iterator boost_range_begin( std::pair<Iterator,Iterator>& p )
    1.72 +    {
    1.73 +        return p.first;
    1.74 +    }
    1.75 +
    1.76 +    //////////////////////////////////////////////////////////////////////
    1.77 +    // array
    1.78 +    //////////////////////////////////////////////////////////////////////
    1.79 +
    1.80 +    template< typename T, std::size_t sz >
    1.81 +    inline const T* boost_range_begin( const T (&array)[sz] )
    1.82 +    {
    1.83 +        return array;
    1.84 +    }
    1.85 +
    1.86 +    template< typename T, std::size_t sz >
    1.87 +    inline T* boost_range_begin( T (&array)[sz] )
    1.88 +    {
    1.89 +        return array;
    1.90 +    }
    1.91 +
    1.92 +
    1.93 +    //////////////////////////////////////////////////////////////////////
    1.94 +    // string
    1.95 +    //////////////////////////////////////////////////////////////////////
    1.96 +
    1.97 +#if 1 || BOOST_WORKAROUND(__MWERKS__, <= 0x3204 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
    1.98 +// CW up to 9.3 and borland have troubles with function ordering
    1.99 +    inline const char* boost_range_begin( const char* s )
   1.100 +    {
   1.101 +        return s;
   1.102 +    }
   1.103 +
   1.104 +    inline char* boost_range_begin( char* s )
   1.105 +    {
   1.106 +        return s;
   1.107 +    }
   1.108 +
   1.109 +    inline const wchar_t* boost_range_begin( const wchar_t* s )
   1.110 +    {
   1.111 +        return s;
   1.112 +    }
   1.113 +
   1.114 +    inline wchar_t* boost_range_begin( wchar_t* s )
   1.115 +    {
   1.116 +        return s;
   1.117 +    }
   1.118 +#else
   1.119 +    inline const char* boost_range_begin( const char*& s )
   1.120 +    {
   1.121 +        return s;
   1.122 +    }
   1.123 +
   1.124 +    inline char* boost_range_begin( char*& s )
   1.125 +    {
   1.126 +        return s;
   1.127 +    }
   1.128 +
   1.129 +    inline const wchar_t* boost_range_begin( const wchar_t*& s )
   1.130 +    {
   1.131 +        return s;
   1.132 +    }
   1.133 +
   1.134 +    inline wchar_t* boost_range_begin( wchar_t*& s )
   1.135 +    {
   1.136 +        return s;
   1.137 +    }
   1.138 +#endif
   1.139 +
   1.140 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
   1.141 +    !BOOST_WORKAROUND(__GNUC__, < 3) \
   1.142 +    /**/
   1.143 +} // namespace 'range_detail'
   1.144 +#endif
   1.145 +
   1.146 +
   1.147 +template< class T >
   1.148 +inline BOOST_DEDUCED_TYPENAME range_iterator<
   1.149 +                        typename remove_const<T>::type >::type begin( T& r )
   1.150 +{
   1.151 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
   1.152 +    !BOOST_WORKAROUND(__GNUC__, < 3) \
   1.153 +    /**/
   1.154 +    using namespace range_detail;
   1.155 +#endif
   1.156 +    return boost_range_begin( r );
   1.157 +}
   1.158 +
   1.159 +template< class T >
   1.160 +inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type begin( const T& r )
   1.161 +{
   1.162 +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
   1.163 +    !BOOST_WORKAROUND(__GNUC__, < 3) \
   1.164 +    /**/
   1.165 +    using namespace range_detail;
   1.166 +#endif
   1.167 +    return boost_range_begin( r );
   1.168 +}
   1.169 +
   1.170 +#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
   1.171 +// BCB and CW are not able to overload pointer when class overloads are also available.
   1.172 +template<>
   1.173 +inline range_const_iterator<const char*>::type begin<const char*>( const char*& r )
   1.174 +{
   1.175 +    return r;
   1.176 +}
   1.177 +
   1.178 +template<>
   1.179 +inline range_const_iterator<const wchar_t*>::type begin<const wchar_t*>( const wchar_t*& r )
   1.180 +{
   1.181 +    return r;
   1.182 +}
   1.183 +
   1.184 +#endif
   1.185 +
   1.186 +} // namespace boost
   1.187 +
   1.188 +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
   1.189 +
   1.190 +namespace boost
   1.191 +{
   1.192 +    template< class T >
   1.193 +    inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type
   1.194 +    const_begin( const T& r )
   1.195 +    {
   1.196 +        return boost::begin( r );
   1.197 +    }
   1.198 +}
   1.199 +
   1.200 +#endif