negate.hpp 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*!
  2. @file
  3. Forward declares `boost::hana::negate`.
  4. @copyright Louis Dionne 2013-2017
  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. BOOST_HANA_NAMESPACE_BEGIN
  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. constexpr negate_t negate{};
  32. #endif
  33. BOOST_HANA_NAMESPACE_END
  34. #endif // !BOOST_HANA_FWD_NEGATE_HPP