negate.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*!
  2. @file
  3. Forward declares `boost::hana::negate`.
  4. Copyright Louis Dionne 2013-2022
  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_NEGATE_HPP
  9. #define BOOST_HANA_FWD_NEGATE_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. namespace boost { namespace hana {
  13. //! Return the inverse of an element of a group.
  14. //! @ingroup group-Group
  15. //!
  16. //!
  17. //! Example
  18. //! -------
  19. //! @include example/negate.cpp
  20. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  21. constexpr auto negate = [](auto&& x) -> decltype(auto) {
  22. return tag-dispatched;
  23. };
  24. #else
  25. template <typename G, typename = void>
  26. struct negate_impl : negate_impl<G, when<true>> { };
  27. struct negate_t {
  28. template <typename X>
  29. constexpr decltype(auto) operator()(X&& x) const;
  30. };
  31. BOOST_HANA_INLINE_VARIABLE constexpr negate_t negate{};
  32. #endif
  33. }} // end namespace boost::hana
  34. #endif // !BOOST_HANA_FWD_NEGATE_HPP