zero.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*!
  2. @file
  3. Forward declares `boost::hana::zero`.
  4. @copyright Louis Dionne 2013-2016
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_FWD_ZERO_HPP
  9. #define BOOST_HANA_FWD_ZERO_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Identity of `plus`.
  14. //! @ingroup group-Monoid
  15. //!
  16. //! @tparam M
  17. //! The tag (a `Monoid`) of the returned identity.
  18. //!
  19. //!
  20. //! Example
  21. //! -------
  22. //! @include example/zero.cpp
  23. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  24. template <typename M>
  25. constexpr auto zero = []() -> decltype(auto) {
  26. return tag-dispatched;
  27. };
  28. #else
  29. template <typename M, typename = void>
  30. struct zero_impl : zero_impl<M, when<true>> { };
  31. template <typename M>
  32. struct zero_t;
  33. template <typename M>
  34. constexpr zero_t<M> zero{};
  35. #endif
  36. BOOST_HANA_NAMESPACE_END
  37. #endif // !BOOST_HANA_FWD_ZERO_HPP