Files
boost_range/include/boost/range/empty.hpp

68 lines
1.6 KiB
C++
Raw Normal View History

2004-06-29 02:50:07 +00:00
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_EMPTY_HPP
#define BOOST_RANGE_EMPTY_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#include <boost/range/config.hpp>
2004-08-24 13:05:15 +00:00
//#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
//#include <boost/range/detail/empty.hpp>
//#else
2004-06-29 02:50:07 +00:00
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
namespace boost
{
2004-08-16 22:07:07 +00:00
namespace range_detail
2004-06-29 02:50:07 +00:00
{
2004-08-10 16:05:53 +00:00
2004-06-29 02:50:07 +00:00
//////////////////////////////////////////////////////////////////////
2004-08-10 16:05:53 +00:00
// primary template
2004-06-29 02:50:07 +00:00
//////////////////////////////////////////////////////////////////////
template< typename C >
inline bool empty( const C& c )
{
2004-08-20 19:26:34 +00:00
return boost::begin( c ) == boost::end( c );
2004-06-29 02:50:07 +00:00
}
//////////////////////////////////////////////////////////////////////
// string
//////////////////////////////////////////////////////////////////////
inline bool empty( const char* const& s )
2004-06-29 02:50:07 +00:00
{
return s == 0 || s[0] == 0;
}
inline bool empty( const wchar_t* const& s )
2004-06-29 02:50:07 +00:00
{
return s == 0 || s[0] == 0;
}
2004-08-16 22:07:07 +00:00
} // namespace 'range_detail'
2004-06-29 02:50:07 +00:00
2004-08-10 16:05:53 +00:00
template< class T >
inline bool empty( const T& r )
{
2004-08-16 22:07:07 +00:00
return range_detail::empty( r );
2004-08-10 16:05:53 +00:00
}
2004-06-29 02:50:07 +00:00
} // namepace 'boost'
2004-08-24 13:05:15 +00:00
//#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
2004-06-29 02:50:07 +00:00
#endif