imgtools/imglib/boostlibrary/boost/range/begin.hpp
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Boost.Range library
       
     2 //
       
     3 //  Copyright Thorsten Ottosen 2003-2004. Use, modification and
       
     4 //  distribution is subject to the Boost Software License, Version
       
     5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
       
     6 //  http://www.boost.org/LICENSE_1_0.txt)
       
     7 //
       
     8 // For more information, see http://www.boost.org/libs/range/
       
     9 //
       
    10 
       
    11 #ifndef BOOST_RANGE_BEGIN_HPP
       
    12 #define BOOST_RANGE_BEGIN_HPP
       
    13 
       
    14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
       
    15 # pragma once
       
    16 #endif
       
    17 
       
    18 #include <boost/range/config.hpp>
       
    19 
       
    20 #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
       
    21 #include <boost/range/detail/begin.hpp>
       
    22 #else
       
    23 
       
    24 #include <boost/range/iterator.hpp>
       
    25 
       
    26 namespace boost
       
    27 {
       
    28 
       
    29 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
       
    30     !BOOST_WORKAROUND(__GNUC__, < 3) \
       
    31     /**/
       
    32 namespace range_detail
       
    33 {
       
    34 #endif
       
    35 
       
    36     //////////////////////////////////////////////////////////////////////
       
    37     // primary template
       
    38     //////////////////////////////////////////////////////////////////////
       
    39 
       
    40     template< typename C >
       
    41     inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
       
    42     range_begin( C& c )
       
    43     {
       
    44         //
       
    45         // If you get a compile-error here, it is most likely because
       
    46         // you have not implemented range_begin() properly in
       
    47         // the namespace of C
       
    48         //
       
    49         return c.begin();
       
    50     }
       
    51 
       
    52     //////////////////////////////////////////////////////////////////////
       
    53     // pair
       
    54     //////////////////////////////////////////////////////////////////////
       
    55 
       
    56     template< typename Iterator >
       
    57     inline Iterator range_begin( const std::pair<Iterator,Iterator>& p )
       
    58     {
       
    59         return p.first;
       
    60     }
       
    61 
       
    62     template< typename Iterator >
       
    63     inline Iterator range_begin( std::pair<Iterator,Iterator>& p )
       
    64     {
       
    65         return p.first;
       
    66     }
       
    67 
       
    68     //////////////////////////////////////////////////////////////////////
       
    69     // array
       
    70     //////////////////////////////////////////////////////////////////////
       
    71 
       
    72     //
       
    73     // May this be discarded? Or is it needed for bad compilers?
       
    74     //
       
    75     template< typename T, std::size_t sz >
       
    76     inline const T* range_begin( const T (&a)[sz] )
       
    77     {
       
    78         return a;
       
    79     }
       
    80 
       
    81     template< typename T, std::size_t sz >
       
    82     inline T* range_begin( T (&a)[sz] )
       
    83     {
       
    84         return a;
       
    85     }
       
    86 
       
    87 
       
    88 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
       
    89     !BOOST_WORKAROUND(__GNUC__, < 3) \
       
    90     /**/
       
    91 } // namespace 'range_detail'
       
    92 #endif
       
    93 
       
    94 
       
    95 template< class T >
       
    96 inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
       
    97 {
       
    98 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
       
    99     !BOOST_WORKAROUND(__GNUC__, < 3) \
       
   100     /**/
       
   101     using namespace range_detail;
       
   102 #endif
       
   103     return range_begin( r );
       
   104 }
       
   105 
       
   106 template< class T >
       
   107 inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
       
   108 {
       
   109 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
       
   110     !BOOST_WORKAROUND(__GNUC__, < 3) \
       
   111     /**/
       
   112     using namespace range_detail;
       
   113 #endif
       
   114     return range_begin( r );
       
   115 }
       
   116 
       
   117 } // namespace boost
       
   118 
       
   119 #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
       
   120 
       
   121 namespace boost
       
   122 {
       
   123     template< class T >
       
   124     inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
       
   125     const_begin( const T& r )
       
   126     {
       
   127         return boost::begin( r );
       
   128     }
       
   129 }
       
   130 
       
   131 #endif
       
   132