erase_key.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*!
  2. @file
  3. Defines `boost::hana::erase_key`.
  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_ERASE_KEY_HPP
  9. #define BOOST_HANA_ERASE_KEY_HPP
  10. #include <boost/hana/fwd/erase_key.hpp>
  11. #include <boost/hana/config.hpp>
  12. #include <boost/hana/core/dispatch.hpp>
  13. namespace boost { namespace hana {
  14. //! @cond
  15. template <typename Set, typename ...Args>
  16. constexpr decltype(auto) erase_key_t::operator()(Set&& set, Args&& ...args) const {
  17. return erase_key_impl<typename hana::tag_of<Set>::type>::apply(
  18. static_cast<Set&&>(set),
  19. static_cast<Args&&>(args)...
  20. );
  21. }
  22. //! @endcond
  23. template <typename T, bool condition>
  24. struct erase_key_impl<T, when<condition>> : default_ {
  25. template <typename ...Args>
  26. static constexpr auto apply(Args&& ...) = delete;
  27. };
  28. }} // end namespace boost::hana
  29. #endif // !BOOST_HANA_ERASE_KEY_HPP