]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/fwd/adjust.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / hana / fwd / adjust.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::adjust`.
4
5 @copyright Louis Dionne 2013-2017
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)
8 */
9
10 #ifndef BOOST_HANA_FWD_ADJUST_HPP
11 #define BOOST_HANA_FWD_ADJUST_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Apply a function on all the elements of a structure that compare
19 //! equal to some value.
20 //! @ingroup group-Functor
21 //!
22 //!
23 //! Signature
24 //! ---------
25 //! Given `F` a Functor and `U` a type that can be compared with `T`'s,
26 //! the signature is
27 //! \f$
28 //! \mathtt{adjust} : F(T) \times U \times (T \to T) \to F(T)
29 //! \f$
30 //!
31 //! @param xs
32 //! The structure to adjust with `f`.
33 //!
34 //! @param value
35 //! An object that is compared with each element `x` of the structure.
36 //! Elements of the structure that compare equal to `value` are adjusted
37 //! with the `f` function.
38 //!
39 //! @param f
40 //! A function called as `f(x)` on the element(s) of the structure that
41 //! compare equal to `value`.
42 //!
43 //!
44 //! Example
45 //! -------
46 //! @include example/adjust.cpp
47 #ifdef BOOST_HANA_DOXYGEN_INVOKED
48 constexpr auto adjust = [](auto&& xs, auto&& value, auto&& f) {
49 return tag-dispatched;
50 };
51 #else
52 template <typename Xs, typename = void>
53 struct adjust_impl : adjust_impl<Xs, when<true>> { };
54
55 struct adjust_t {
56 template <typename Xs, typename Value, typename F>
57 constexpr auto operator()(Xs&& xs, Value&& value, F&& f) const;
58 };
59
60 constexpr adjust_t adjust{};
61 #endif
62 BOOST_HANA_NAMESPACE_END
63
64 #endif // !BOOST_HANA_FWD_ADJUST_HPP