]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*! |
2 | @file | |
3 | Forward declares `boost::hana::accessors`. | |
4 | ||
5 | @copyright Louis Dionne 2013-2016 | |
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
8 | */ | |
9 | ||
10 | #ifndef BOOST_HANA_FWD_ACCESSORS_HPP | |
11 | #define BOOST_HANA_FWD_ACCESSORS_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/core/when.hpp> | |
15 | ||
16 | ||
17 | BOOST_HANA_NAMESPACE_BEGIN | |
18 | //! Returns a `Sequence` of pairs representing the accessors of the | |
19 | //! data structure. | |
20 | //! @ingroup group-Struct | |
21 | //! | |
22 | //! Given a `Struct` `S`, `accessors<S>()` is a `Sequence` of `Product`s | |
23 | //! where the first element of each pair is the "name" of a member of | |
24 | //! the `Struct`, and the second element of each pair is a function that | |
25 | //! can be used to access that member when given an object of the proper | |
26 | //! data type. As described in the global documentation for `Struct`, the | |
27 | //! accessor functions in this sequence must be move-independent. | |
28 | //! | |
29 | //! | |
30 | //! Example | |
31 | //! ------- | |
32 | //! @include example/accessors.cpp | |
33 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
34 | template <typename S> | |
35 | constexpr auto accessors = []() { | |
36 | return tag-dispatched; | |
37 | }; | |
38 | #else | |
39 | template <typename S, typename = void> | |
40 | struct accessors_impl : accessors_impl<S, when<true>> { }; | |
41 | ||
42 | template <typename S> | |
43 | struct accessors_t; | |
44 | ||
45 | template <typename S> | |
46 | constexpr accessors_t<S> accessors{}; | |
47 | #endif | |
48 | BOOST_HANA_NAMESPACE_END | |
49 | ||
50 | #endif // !BOOST_HANA_FWD_ACCESSORS_HPP |