os/ossrv/ossrv_pub/boost_apis/boost/range/detail/empty.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/range/detail/empty.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,120 @@
     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_DETAIL_EMPTY_HPP
    1.15 +#define BOOST_RANGE_DETAIL_EMPTY_HPP
    1.16 +
    1.17 +#include <boost/range/detail/common.hpp>
    1.18 +
    1.19 +namespace boost 
    1.20 +{
    1.21 +    namespace range_detail
    1.22 +    {
    1.23 +        template< typename T >
    1.24 +        struct range_empty;
    1.25 +
    1.26 +        //////////////////////////////////////////////////////////////////////
    1.27 +        // default
    1.28 +        //////////////////////////////////////////////////////////////////////
    1.29 +        
    1.30 +        template<>
    1.31 +        struct range_empty<std_container_>
    1.32 +        {
    1.33 +            template< typename C >
    1.34 +            static bool fun( C& c )
    1.35 +            {
    1.36 +                return c.empty();
    1.37 +            };
    1.38 +        };
    1.39 +                    
    1.40 +        //////////////////////////////////////////////////////////////////////
    1.41 +        // pair
    1.42 +        //////////////////////////////////////////////////////////////////////
    1.43 +        
    1.44 +        template<>
    1.45 +        struct range_empty<std_pair_>
    1.46 +        {
    1.47 +            template< typename P >
    1.48 +            static bool fun( const P& p )
    1.49 +            {
    1.50 +                return p.first == p.second;
    1.51 +            }
    1.52 +        };
    1.53 + 
    1.54 +        //////////////////////////////////////////////////////////////////////
    1.55 +        // array
    1.56 +        //////////////////////////////////////////////////////////////////////
    1.57 +        
    1.58 +        template<>
    1.59 +        struct range_empty<array_>
    1.60 +        {
    1.61 +            template< typename T, std::size_t sz >
    1.62 +            static bool fun( T BOOST_ARRAY_REF[sz] )
    1.63 +            {
    1.64 +                if( boost_range_array == 0 )
    1.65 +                    return true;
    1.66 +                return false;
    1.67 +            }
    1.68 +        };
    1.69 +
    1.70 +        //////////////////////////////////////////////////////////////////////
    1.71 +        // string
    1.72 +        //////////////////////////////////////////////////////////////////////
    1.73 +        
    1.74 +        template<>
    1.75 +        struct range_empty<char_ptr_>
    1.76 +        {
    1.77 +            static bool fun( const char* s )
    1.78 +            {
    1.79 +                return s == 0 || s[0] == 0;
    1.80 +            }
    1.81 +        };
    1.82 +
    1.83 +        template<>
    1.84 +        struct range_empty<const_char_ptr_>
    1.85 +        {
    1.86 +            static bool fun( const char* s )
    1.87 +            {
    1.88 +                return  s == 0 || s[0] == 0;
    1.89 +            }
    1.90 +        };
    1.91 +
    1.92 +        template<>
    1.93 +        struct range_empty<wchar_t_ptr_>
    1.94 +        {
    1.95 +            static bool fun( const wchar_t* s )
    1.96 +            {
    1.97 +                return  s == 0 || s[0] == 0;
    1.98 +            }
    1.99 +        };
   1.100 +        
   1.101 +        template<>
   1.102 +        struct range_empty<const_wchar_t_ptr_>
   1.103 +        {
   1.104 +            static bool fun( const wchar_t* s )
   1.105 +            {
   1.106 +                return  s == 0 || s[0] == 0;
   1.107 +            }
   1.108 +        };
   1.109 +
   1.110 +    } // namespace 'range_detail'
   1.111 +    
   1.112 +        
   1.113 +    template< typename C >
   1.114 +    inline bool 
   1.115 +    empty( const C& c )
   1.116 +    {
   1.117 +        return range_detail::range_empty<  BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
   1.118 +    }
   1.119 +
   1.120 +} // namespace 'boost'
   1.121 +
   1.122 +
   1.123 +#endif