|
||||
File indexing completed on 2024-11-15 09:13:43
0001 /*! 0002 @file 0003 Forward declares `boost::hana::contains` and `boost::hana::in`. 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_CONTAINS_HPP 0011 #define BOOST_HANA_FWD_CONTAINS_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 #include <boost/hana/functional/flip.hpp> 0016 #include <boost/hana/functional/infix.hpp> 0017 0018 0019 namespace boost { namespace hana { 0020 //! Returns whether the key occurs in the structure. 0021 //! @ingroup group-Searchable 0022 //! 0023 //! Given a `Searchable` structure `xs` and a `key`, `contains` returns 0024 //! whether any of the keys of the structure is equal to the given `key`. 0025 //! If the structure is not finite, an equal key has to appear at a finite 0026 //! position in the structure for this method to finish. For convenience, 0027 //! `contains` can also be applied in infix notation. 0028 //! 0029 //! 0030 //! @param xs 0031 //! The structure to search. 0032 //! 0033 //! @param key 0034 //! A key to be searched for in the structure. The key has to be 0035 //! `Comparable` with the other keys of the structure. 0036 //! 0037 //! 0038 //! Example 0039 //! ------- 0040 //! @include example/contains.cpp 0041 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0042 constexpr auto contains = [](auto&& xs, auto&& key) { 0043 return tag-dispatched; 0044 }; 0045 #else 0046 template <typename S, typename = void> 0047 struct contains_impl : contains_impl<S, when<true>> { }; 0048 0049 struct contains_t { 0050 template <typename Xs, typename Key> 0051 constexpr auto operator()(Xs&& xs, Key&& key) const; 0052 }; 0053 0054 BOOST_HANA_INLINE_VARIABLE constexpr auto contains = hana::infix(contains_t{}); 0055 #endif 0056 0057 //! Return whether the key occurs in the structure. 0058 //! @ingroup group-Searchable 0059 //! 0060 //! Specifically, this is equivalent to `contains`, except `in` takes its 0061 //! arguments in reverse order. Like `contains`, `in` can also be applied 0062 //! in infix notation for increased expressiveness. This function is not a 0063 //! method that can be overriden; it is just a convenience function 0064 //! provided with the concept. 0065 //! 0066 //! 0067 //! Example 0068 //! ------- 0069 //! @include example/in.cpp 0070 BOOST_HANA_INLINE_VARIABLE constexpr auto in = hana::infix(hana::flip(hana::contains)); 0071 }} // end namespace boost::hana 0072 0073 #endif // !BOOST_HANA_FWD_CONTAINS_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |