any.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*!
  2. @file
  3. Forward declares `boost::hana::any`.
  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_ANY_HPP
  9. #define BOOST_HANA_FWD_ANY_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Returns whether any key of the structure is true-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 for
  18. //! this method to finish.
  19. //!
  20. //!
  21. //! Example
  22. //! -------
  23. //! @include example/any.cpp
  24. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  25. constexpr auto any = [](auto&& xs) {
  26. return tag-dispatched;
  27. };
  28. #else
  29. template <typename S, typename = void>
  30. struct any_impl : any_impl<S, when<true>> { };
  31. struct any_t {
  32. template <typename Xs>
  33. constexpr auto operator()(Xs&& xs) const;
  34. };
  35. constexpr any_t any{};
  36. #endif
  37. BOOST_HANA_NAMESPACE_END
  38. #endif // !BOOST_HANA_FWD_ANY_HPP