|
||||
File indexing completed on 2024-11-15 09:13:43
0001 /*! 0002 @file 0003 Forward declares `boost::hana::is_empty`. 0004 0005 Copyright Louis Dionne 2013-2022 0006 Distributed under the Boost Software License, Version 1.0. 0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0008 */ 0009 0010 #ifndef BOOST_HANA_FWD_IS_EMPTY_HPP 0011 #define BOOST_HANA_FWD_IS_EMPTY_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Returns whether the iterable is empty. 0019 //! @ingroup group-Iterable 0020 //! 0021 //! Given an `Iterable` `xs`, `is_empty` returns whether `xs` contains 0022 //! no more elements. In other words, it returns whether trying to 0023 //! extract the tail of `xs` would be an error. In the current version 0024 //! of the library, `is_empty` must return an `IntegralConstant` holding 0025 //! a value convertible to `bool`. This is because only compile-time 0026 //! `Iterable`s are supported right now. 0027 //! 0028 //! 0029 //! Example 0030 //! ------- 0031 //! @include example/is_empty.cpp 0032 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0033 constexpr auto is_empty = [](auto const& xs) { 0034 return tag-dispatched; 0035 }; 0036 #else 0037 template <typename It, typename = void> 0038 struct is_empty_impl : is_empty_impl<It, when<true>> { }; 0039 0040 struct is_empty_t { 0041 template <typename Xs> 0042 constexpr auto operator()(Xs const& xs) const; 0043 }; 0044 0045 BOOST_HANA_INLINE_VARIABLE constexpr is_empty_t is_empty{}; 0046 #endif 0047 }} // end namespace boost::hana 0048 0049 #endif // !BOOST_HANA_FWD_IS_EMPTY_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |