3 Forward declares `boost::hana::find`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_FIND_HPP
11 #define BOOST_HANA_FWD_FIND_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Finds the value associated to the given key in a structure.
19 //! @ingroup group-Searchable
21 //! Given a `key` and a `Searchable` structure, `find` returns the `just`
22 //! the first value whose key is equal to the given `key`, or `nothing` if
23 //! there is no such key. Comparison is done with `equal`. `find` satisfies
26 //! find(xs, key) == find_if(xs, equal.to(key))
31 //! The structure to be searched.
34 //! A key to be searched for in the structure. The key has to be
35 //! `Comparable` with the other keys of the structure. In the current
36 //! version of the library, the comparison of `key` with any other key
37 //! of the structure must return a compile-time `Logical`.
42 //! @include example/find.cpp
43 #ifdef BOOST_HANA_DOXYGEN_INVOKED
44 constexpr auto find = [](auto&& xs, auto const& key) {
45 return tag-dispatched;
48 template <typename S, typename = void>
49 struct find_impl : find_impl<S, when<true>> { };
52 template <typename Xs, typename Key>
53 constexpr auto operator()(Xs&& xs, Key const& key) const;
56 constexpr find_t find{};
58 BOOST_HANA_NAMESPACE_END
60 #endif // !BOOST_HANA_FWD_FIND_HPP