adapt_struct.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. @file
  3. Documents the `BOOST_HANA_ADAPT_STRUCT` macro.
  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_ADAPT_STRUCT_HPP
  9. #define BOOST_HANA_FWD_ADAPT_STRUCT_HPP
  10. #include <boost/hana/config.hpp>
  11. BOOST_HANA_NAMESPACE_BEGIN
  12. // Note:
  13. // The weird definition as a variable seems to exploit a glitch in Doxygen
  14. // which makes the macro appear in the related objects of Struct (as we
  15. // want it to).
  16. //! Defines a model of `Struct` with the given members.
  17. //! @ingroup group-Struct
  18. //!
  19. //! Using this macro at _global scope_ will define a model of the `Struct`
  20. //! concept for the given type. This can be used to easily adapt existing
  21. //! user-defined types in a ad-hoc manner. Unlike the
  22. //! `BOOST_HANA_DEFINE_STRUCT` macro, this macro does not
  23. //! require the types of the members to be specified.
  24. //!
  25. //! @note
  26. //! This macro only works if the tag of the user-defined type `T` is `T`
  27. //! itself. This is the case unless you specifically asked for something
  28. //! different; see `tag_of`'s documentation.
  29. //!
  30. //!
  31. //! Example
  32. //! -------
  33. //! @include example/adapt_struct.cpp
  34. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  35. auto BOOST_HANA_ADAPT_STRUCT(...) = ;
  36. #define BOOST_HANA_ADAPT_STRUCT(Name, ...) see documentation
  37. #else
  38. // defined in <boost/hana/adapt_struct.hpp>
  39. #endif
  40. BOOST_HANA_NAMESPACE_END
  41. #endif // !BOOST_HANA_FWD_ADAPT_STRUCT_HPP