none.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*!
  2. @file
  3. Forward declares `boost::hana::none`.
  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_NONE_HPP
  9. #define BOOST_HANA_FWD_NONE_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Returns whether all of the keys of the structure are false-valued.
  14. //! @ingroup group-Searchable
  15. //!
  16. //! The keys of the structure must be `Logical`s. If the structure is not
  17. //! finite, a true-valued key must appear at a finite "index" in order
  18. //! for this method to finish.
  19. //!
  20. //!
  21. //! Example
  22. //! -------
  23. //! @include example/none.cpp
  24. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  25. constexpr auto none = [](auto&& xs) -> decltype(auto) {
  26. return tag-dispatched;
  27. };
  28. #else
  29. template <typename S, typename = void>
  30. struct none_impl : none_impl<S, when<true>> { };
  31. struct none_t {
  32. template <typename Xs>
  33. constexpr auto operator()(Xs&& xs) const;
  34. };
  35. constexpr none_t none{};
  36. #endif
  37. BOOST_HANA_NAMESPACE_END
  38. #endif // !BOOST_HANA_FWD_NONE_HPP