|
|
|||
File indexing completed on 2025-12-15 09:53:03
0001 /*! 0002 @file 0003 Forward declares `boost::hana::find`. 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_FIND_HPP 0011 #define BOOST_HANA_FWD_FIND_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Finds the value associated to the given key in a structure. 0019 //! @ingroup group-Searchable 0020 //! 0021 //! Given a `key` and a `Searchable` structure, `find` returns the `just` 0022 //! the first value whose key is equal to the given `key`, or `nothing` if 0023 //! there is no such key. Comparison is done with `equal`. `find` satisfies 0024 //! the following: 0025 //! @code 0026 //! find(xs, key) == find_if(xs, equal.to(key)) 0027 //! @endcode 0028 //! 0029 //! 0030 //! @param xs 0031 //! The structure to be searched. 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. In the current 0036 //! version of the library, the comparison of `key` with any other key 0037 //! of the structure must return a compile-time `Logical`. 0038 //! 0039 //! 0040 //! Example 0041 //! ------- 0042 //! @include example/find.cpp 0043 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0044 constexpr auto find = [](auto&& xs, auto const& key) { 0045 return tag-dispatched; 0046 }; 0047 #else 0048 template <typename S, typename = void> 0049 struct find_impl : find_impl<S, when<true>> { }; 0050 0051 struct find_t { 0052 template <typename Xs, typename Key> 0053 constexpr auto operator()(Xs&& xs, Key const& key) const; 0054 }; 0055 0056 BOOST_HANA_INLINE_VARIABLE constexpr find_t find{}; 0057 #endif 0058 }} // end namespace boost::hana 0059 0060 #endif // !BOOST_HANA_FWD_FIND_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|