1 // Boost.Range library |
1 |
|
2 #ifndef BOOST_MPL_EMPTY_HPP_INCLUDED |
|
3 #define BOOST_MPL_EMPTY_HPP_INCLUDED |
|
4 |
|
5 // Copyright Aleksey Gurtovoy 2000-2004 |
2 // |
6 // |
3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and |
7 // Distributed under the Boost Software License, Version 1.0. |
4 // distribution is subject to the Boost Software License, Version |
8 // (See accompanying file LICENSE_1_0.txt or copy at |
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
9 // http://www.boost.org/LICENSE_1_0.txt) |
6 // http://www.boost.org/LICENSE_1_0.txt) |
|
7 // |
10 // |
8 // For more information, see http://www.boost.org/libs/range/ |
11 // See http://www.boost.org/libs/mpl for documentation. |
9 // |
|
10 |
12 |
11 #ifndef BOOST_RANGE_EMPTY_HPP |
13 // $Source: /cvsroot/boost/boost/boost/mpl/empty.hpp,v $ |
12 #define BOOST_RANGE_EMPTY_HPP |
14 // $Date: 2004/09/02 15:40:41 $ |
|
15 // $Revision: 1.4 $ |
13 |
16 |
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) |
17 #include <boost/mpl/empty_fwd.hpp> |
15 # pragma once |
18 #include <boost/mpl/sequence_tag.hpp> |
16 #endif |
19 #include <boost/mpl/aux_/empty_impl.hpp> |
|
20 #include <boost/mpl/aux_/na_spec.hpp> |
|
21 #include <boost/mpl/aux_/lambda_support.hpp> |
17 |
22 |
18 #include <boost/range/config.hpp> |
23 namespace boost { namespace mpl { |
19 //#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
20 //#include <boost/range/detail/empty.hpp> |
|
21 //#else |
|
22 |
24 |
23 #include <boost/range/begin.hpp> |
25 template< |
24 #include <boost/range/end.hpp> |
26 typename BOOST_MPL_AUX_NA_PARAM(Sequence) |
|
27 > |
|
28 struct empty |
|
29 : empty_impl< typename sequence_tag<Sequence>::type > |
|
30 ::template apply< Sequence > |
|
31 { |
|
32 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,empty,(Sequence)) |
|
33 }; |
25 |
34 |
26 namespace boost |
35 BOOST_MPL_AUX_NA_SPEC(1, empty) |
27 { |
|
28 namespace range_detail |
|
29 { |
|
30 |
36 |
31 ////////////////////////////////////////////////////////////////////// |
37 }} |
32 // primary template |
|
33 ////////////////////////////////////////////////////////////////////// |
|
34 |
38 |
35 template< typename C > |
39 #endif // BOOST_MPL_EMPTY_HPP_INCLUDED |
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 |
|