]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/pfr/tuple_size.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / pfr / tuple_size.hpp
1 // Copyright (c) 2016-2020 Antony Polukhin
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6
7 #ifndef BOOST_PFR_TUPLE_SIZE_HPP
8 #define BOOST_PFR_TUPLE_SIZE_HPP
9 #pragma once
10
11 #include <boost/pfr/detail/config.hpp>
12
13 #include <type_traits>
14 #include <utility> // metaprogramming stuff
15
16 #include <boost/pfr/detail/sequence_tuple.hpp>
17 #include <boost/pfr/detail/fields_count.hpp>
18
19 /// \file boost/pfr/tuple_size.hpp
20 /// Contains tuple-like interfaces to get fields count \forcedlink{tuple_size}, \forcedlink{tuple_size_v}.
21 ///
22 /// \b Synopsis:
23 namespace boost { namespace pfr {
24
25 /// Has a static const member variable `value` that contains fields count in a T.
26 /// Works for any T that supports aggregate initialization.
27 ///
28 /// \b Example:
29 /// \code
30 /// std::array<int, boost::pfr::tuple_size<my_structure>::value > a;
31 /// \endcode
32 template <class T>
33 using tuple_size = detail::size_t_< boost::pfr::detail::fields_count<T>() >;
34
35
36 /// `tuple_size_v` is a template variable that contains fields count in a T and
37 /// works for any T that supports aggregate initialization.
38 ///
39 /// \b Example:
40 /// \code
41 /// std::array<int, boost::pfr::tuple_size_v<my_structure> > a;
42 /// \endcode
43 template <class T>
44 constexpr std::size_t tuple_size_v = tuple_size<T>::value;
45
46 }} // namespace boost::pfr
47
48 #endif // BOOST_PFR_TUPLE_SIZE_HPP