members.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*!
  2. @file
  3. Forward declares `boost::hana::members`.
  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_MEMBERS_HPP
  9. #define BOOST_HANA_FWD_MEMBERS_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Returns a `Sequence` containing the members of a `Struct`.
  14. //! @ingroup group-Struct
  15. //!
  16. //! Given a `Struct` object, `members` returns a `Sequence` containing
  17. //! all the members of the `Struct`, in the same order as their respective
  18. //! accessor appears in the `accessors` sequence.
  19. //!
  20. //!
  21. //! Example
  22. //! -------
  23. //! @include example/members.cpp
  24. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  25. constexpr auto members = [](auto&& object) {
  26. return tag-dispatched;
  27. };
  28. #else
  29. template <typename S, typename = void>
  30. struct members_impl : members_impl<S, when<true>> { };
  31. struct members_t {
  32. template <typename Object>
  33. constexpr auto operator()(Object&& object) const;
  34. };
  35. constexpr members_t members{};
  36. #endif
  37. BOOST_HANA_NAMESPACE_END
  38. #endif // !BOOST_HANA_FWD_MEMBERS_HPP