author | William Roberts <williamr@symbian.org> |
Tue, 16 Mar 2010 16:12:26 +0000 | |
branch | Symbian2 |
changeset 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
// Boost.Range library |
williamr@2 | 2 |
// |
williamr@2 | 3 |
// Copyright Thorsten Ottosen 2003-2004. Use, modification and |
williamr@2 | 4 |
// distribution is subject to the Boost Software License, Version |
williamr@2 | 5 |
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
williamr@2 | 6 |
// http://www.boost.org/LICENSE_1_0.txt) |
williamr@2 | 7 |
// |
williamr@2 | 8 |
// For more information, see http://www.boost.org/libs/range/ |
williamr@2 | 9 |
// |
williamr@2 | 10 |
|
williamr@2 | 11 |
#ifndef BOOST_RANGE_EMPTY_HPP |
williamr@2 | 12 |
#define BOOST_RANGE_EMPTY_HPP |
williamr@2 | 13 |
|
williamr@2 | 14 |
#if defined(_MSC_VER) && (_MSC_VER >= 1200) |
williamr@2 | 15 |
# pragma once |
williamr@2 | 16 |
#endif |
williamr@2 | 17 |
|
williamr@2 | 18 |
#include <boost/range/config.hpp> |
williamr@2 | 19 |
//#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
williamr@2 | 20 |
//#include <boost/range/detail/empty.hpp> |
williamr@2 | 21 |
//#else |
williamr@2 | 22 |
|
williamr@2 | 23 |
#include <boost/range/begin.hpp> |
williamr@2 | 24 |
#include <boost/range/end.hpp> |
williamr@2 | 25 |
|
williamr@2 | 26 |
namespace boost |
williamr@2 | 27 |
{ |
williamr@2 | 28 |
namespace range_detail |
williamr@2 | 29 |
{ |
williamr@2 | 30 |
|
williamr@2 | 31 |
////////////////////////////////////////////////////////////////////// |
williamr@2 | 32 |
// primary template |
williamr@2 | 33 |
////////////////////////////////////////////////////////////////////// |
williamr@2 | 34 |
|
williamr@2 | 35 |
template< typename C > |
williamr@2 | 36 |
inline bool empty( const C& c ) |
williamr@2 | 37 |
{ |
williamr@2 | 38 |
return boost::begin( c ) == boost::end( c ); |
williamr@2 | 39 |
} |
williamr@2 | 40 |
|
williamr@2 | 41 |
////////////////////////////////////////////////////////////////////// |
williamr@2 | 42 |
// string |
williamr@2 | 43 |
////////////////////////////////////////////////////////////////////// |
williamr@2 | 44 |
|
williamr@2 | 45 |
inline bool empty( const char* const& s ) |
williamr@2 | 46 |
{ |
williamr@2 | 47 |
return s == 0 || s[0] == 0; |
williamr@2 | 48 |
} |
williamr@2 | 49 |
|
williamr@2 | 50 |
inline bool empty( const wchar_t* const& s ) |
williamr@2 | 51 |
{ |
williamr@2 | 52 |
return s == 0 || s[0] == 0; |
williamr@2 | 53 |
} |
williamr@2 | 54 |
|
williamr@2 | 55 |
} // namespace 'range_detail' |
williamr@2 | 56 |
|
williamr@2 | 57 |
template< class T > |
williamr@2 | 58 |
inline bool empty( const T& r ) |
williamr@2 | 59 |
{ |
williamr@2 | 60 |
return range_detail::empty( r ); |
williamr@2 | 61 |
} |
williamr@2 | 62 |
|
williamr@2 | 63 |
} // namepace 'boost' |
williamr@2 | 64 |
|
williamr@2 | 65 |
//#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
williamr@2 | 66 |
|
williamr@2 | 67 |
#endif |