none_of.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*!
  2. @file
  3. Forward declares `boost::hana::none_of`.
  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_OF_HPP
  9. #define BOOST_HANA_FWD_NONE_OF_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Returns whether none of the keys of the structure satisfy the
  14. //! `predicate`.
  15. //! @ingroup group-Searchable
  16. //!
  17. //! If the structure is not finite, `predicate` has to return a true-
  18. //! valued `Logical` after looking at a finite number of keys for this
  19. //! method to finish.
  20. //!
  21. //!
  22. //! @param xs
  23. //! The structure to search.
  24. //!
  25. //! @param predicate
  26. //! A function called as `predicate(k)`, where `k` is a key of the
  27. //! structure, and returning a `Logical`.
  28. //!
  29. //!
  30. //! Example
  31. //! -------
  32. //! @include example/none_of.cpp
  33. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  34. constexpr auto none_of = [](auto&& xs, auto&& predicate) {
  35. return tag-dispatched;
  36. };
  37. #else
  38. template <typename S, typename = void>
  39. struct none_of_impl : none_of_impl<S, when<true>> { };
  40. struct none_of_t {
  41. template <typename Xs, typename Pred>
  42. constexpr auto operator()(Xs&& xs, Pred&& pred) const;
  43. };
  44. constexpr none_of_t none_of{};
  45. #endif
  46. BOOST_HANA_NAMESPACE_END
  47. #endif // !BOOST_HANA_FWD_NONE_OF_HPP