| 37 | }; |
| 38 | |
| 39 | int main() { |
| 40 | { |
| 41 | Foo foo = {{1.0f, 2.0f, 3.0f}}; |
| 42 | auto accessors = hana::accessors<Foo>(); |
| 43 | auto get_array = hana::second(hana::at_c<0>(accessors)); |
| 44 | static_assert(std::is_same<decltype(get_array(foo)), float(&)[3]>{}, ""); |
| 45 | float (&array)[3] = get_array(foo); |
| 46 | BOOST_HANA_RUNTIME_CHECK(array[0] == 1.0f); |
| 47 | BOOST_HANA_RUNTIME_CHECK(array[1] == 2.0f); |
| 48 | BOOST_HANA_RUNTIME_CHECK(array[2] == 3.0f); |
| 49 | } |
| 50 | |
| 51 | { |
| 52 | Bar bar = {{1.0f, 2.0f, 3.0f}}; |
| 53 | auto accessors = hana::accessors<Bar>(); |
| 54 | auto get_array = hana::second(hana::at_c<0>(accessors)); |
| 55 | static_assert(std::is_same<decltype(get_array(bar)), float(&)[3]>{}, ""); |
| 56 | float (&array)[3] = get_array(bar); |
| 57 | BOOST_HANA_RUNTIME_CHECK(array[0] == 1.0f); |
| 58 | BOOST_HANA_RUNTIME_CHECK(array[1] == 2.0f); |
| 59 | BOOST_HANA_RUNTIME_CHECK(array[2] == 3.0f); |
| 60 | } |
| 61 | } |