adapt_adt.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. @file
  3. Documents the `BOOST_HANA_ADAPT_ADT` 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_ADT_HPP
  9. #define BOOST_HANA_FWD_ADAPT_ADT_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 accessors.
  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 `BOOST_HANA_ADAPT_STRUCT`,
  22. //! this macro requires specifying the way to retrieve each member by
  23. //! providing a function that does the extraction.
  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_adt.cpp
  34. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  35. auto BOOST_HANA_ADAPT_ADT(...) = ;
  36. #define BOOST_HANA_ADAPT_ADT(Name, ...) see documentation
  37. #else
  38. // defined in <boost/hana/adapt_adt.hpp>
  39. #endif
  40. BOOST_HANA_NAMESPACE_END
  41. #endif // !BOOST_HANA_FWD_ADAPT_ADT_HPP