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