]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*! |
2 | @file | |
3 | Forward declares `boost::hana::zero`. | |
4 | ||
b32b8144 | 5 | @copyright Louis Dionne 2013-2017 |
7c673cae FG |
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_ZERO_HPP | |
11 | #define BOOST_HANA_FWD_ZERO_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/core/when.hpp> | |
15 | ||
16 | ||
1e59de90 | 17 | namespace boost { namespace hana { |
7c673cae FG |
18 | //! Identity of `plus`. |
19 | //! @ingroup group-Monoid | |
20 | //! | |
21 | //! @tparam M | |
22 | //! The tag (a `Monoid`) of the returned identity. | |
23 | //! | |
24 | //! | |
25 | //! Example | |
26 | //! ------- | |
27 | //! @include example/zero.cpp | |
28 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
29 | template <typename M> | |
30 | constexpr auto zero = []() -> decltype(auto) { | |
31 | return tag-dispatched; | |
32 | }; | |
33 | #else | |
34 | template <typename M, typename = void> | |
35 | struct zero_impl : zero_impl<M, when<true>> { }; | |
36 | ||
37 | template <typename M> | |
92f5a8d4 TL |
38 | struct zero_t { |
39 | constexpr decltype(auto) operator()() const; | |
40 | }; | |
7c673cae FG |
41 | |
42 | template <typename M> | |
1e59de90 | 43 | BOOST_HANA_INLINE_VARIABLE constexpr zero_t<M> zero{}; |
7c673cae | 44 | #endif |
1e59de90 | 45 | }} // end namespace boost::hana |
7c673cae FG |
46 | |
47 | #endif // !BOOST_HANA_FWD_ZERO_HPP |