]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/accessors.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / accessors.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines `boost::hana::accessors`.
4
5@copyright Louis Dionne 2013-2016
6Distributed 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_ACCESSORS_HPP
11#define BOOST_HANA_ACCESSORS_HPP
12
13#include <boost/hana/fwd/accessors.hpp>
14
15#include <boost/hana/concept/struct.hpp>
16#include <boost/hana/config.hpp>
17#include <boost/hana/core/dispatch.hpp>
18
19
20BOOST_HANA_NAMESPACE_BEGIN
21 template <typename S>
22 struct accessors_t {
23 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
24 static_assert(hana::Struct<S>::value,
25 "hana::accessors<S> requires 'S' to be a Struct");
26 #endif
27
28 constexpr decltype(auto) operator()() const {
29 using Accessors = BOOST_HANA_DISPATCH_IF(accessors_impl<S>,
30 hana::Struct<S>::value
31 );
32
33 return Accessors::apply();
34 }
35 };
36
37 template <typename S, bool condition>
38 struct accessors_impl<S, when<condition>> : default_ {
39 template <typename ...Args>
40 static constexpr auto apply(Args&& ...) = delete;
41 };
42
43 namespace struct_detail {
44 template <typename ...>
45 struct is_valid { static constexpr bool value = true; };
46 }
47
48 template <typename S>
49 struct accessors_impl<S, when<
50 struct_detail::is_valid<typename S::hana_accessors_impl>::value
51 >>
52 : S::hana_accessors_impl
53 { };
54BOOST_HANA_NAMESPACE_END
55
56#endif // !BOOST_HANA_ACCESSORS_HPP