|
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_EMPTY_HPP |
|
12 #define BOOST_RANGE_EMPTY_HPP |
|
13 |
|
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) |
|
15 # pragma once |
|
16 #endif |
|
17 |
|
18 #include <boost/range/config.hpp> |
|
19 //#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
20 //#include <boost/range/detail/empty.hpp> |
|
21 //#else |
|
22 |
|
23 #include <boost/range/begin.hpp> |
|
24 #include <boost/range/end.hpp> |
|
25 |
|
26 namespace boost |
|
27 { |
|
28 namespace range_detail |
|
29 { |
|
30 |
|
31 ////////////////////////////////////////////////////////////////////// |
|
32 // primary template |
|
33 ////////////////////////////////////////////////////////////////////// |
|
34 |
|
35 template< typename C > |
|
36 inline bool empty( const C& c ) |
|
37 { |
|
38 return boost::begin( c ) == boost::end( c ); |
|
39 } |
|
40 |
|
41 ////////////////////////////////////////////////////////////////////// |
|
42 // string |
|
43 ////////////////////////////////////////////////////////////////////// |
|
44 |
|
45 inline bool empty( const char* const& s ) |
|
46 { |
|
47 return s == 0 || s[0] == 0; |
|
48 } |
|
49 |
|
50 inline bool empty( const wchar_t* const& s ) |
|
51 { |
|
52 return s == 0 || s[0] == 0; |
|
53 } |
|
54 |
|
55 } // namespace 'range_detail' |
|
56 |
|
57 template< class T > |
|
58 inline bool empty( const T& r ) |
|
59 { |
|
60 return range_detail::empty( r ); |
|
61 } |
|
62 |
|
63 } // namepace 'boost' |
|
64 |
|
65 //#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
66 |
|
67 #endif |