all_of.hpp 1.4 KB

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