]>
Commit | Line | Data |
---|---|---|
1 | /*! | |
2 | @file | |
3 | Forward declares `boost::hana::fill`. | |
4 | ||
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) | |
8 | */ | |
9 | ||
10 | #ifndef BOOST_HANA_FWD_FILL_HPP | |
11 | #define BOOST_HANA_FWD_FILL_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/core/when.hpp> | |
15 | ||
16 | ||
17 | BOOST_HANA_NAMESPACE_BEGIN | |
18 | //! Replace all the elements of a structure with a fixed value. | |
19 | //! @ingroup group-Functor | |
20 | //! | |
21 | //! | |
22 | //! Signature | |
23 | //! --------- | |
24 | //! Given `F` a Functor, the signature is | |
25 | //! \f$ | |
26 | //! \mathtt{fill} : F(T) \times U \to F(U) | |
27 | //! \f$ | |
28 | //! | |
29 | //! @param xs | |
30 | //! The structure to fill with a `value`. | |
31 | //! | |
32 | //! @param value | |
33 | //! A value by which every element `x` of the structure is replaced, | |
34 | //! unconditionally. | |
35 | //! | |
36 | //! | |
37 | //! Example | |
38 | //! ------- | |
39 | //! @include example/fill.cpp | |
40 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
41 | constexpr auto fill = [](auto&& xs, auto&& value) { | |
42 | return tag-dispatched; | |
43 | }; | |
44 | #else | |
45 | template <typename Xs, typename = void> | |
46 | struct fill_impl : fill_impl<Xs, when<true>> { }; | |
47 | ||
48 | struct fill_t { | |
49 | template <typename Xs, typename Value> | |
50 | constexpr auto operator()(Xs&& xs, Value&& value) const; | |
51 | }; | |
52 | ||
53 | constexpr fill_t fill{}; | |
54 | #endif | |
55 | BOOST_HANA_NAMESPACE_END | |
56 | ||
57 | #endif // !BOOST_HANA_FWD_FILL_HPP |