![]() |
|
|||
File indexing completed on 2025-09-16 08:42:26
0001 // Copyright (c) 2016-2025 Antony Polukhin 0002 // 0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying 0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0005 0006 0007 #ifndef BOOST_PFR_TUPLE_SIZE_HPP 0008 #define BOOST_PFR_TUPLE_SIZE_HPP 0009 #pragma once 0010 0011 #include <boost/pfr/detail/config.hpp> 0012 0013 #include <type_traits> 0014 #include <utility> // metaprogramming stuff 0015 0016 #include <boost/pfr/detail/sequence_tuple.hpp> 0017 #include <boost/pfr/detail/fields_count.hpp> 0018 0019 /// \file boost/pfr/tuple_size.hpp 0020 /// Contains tuple-like interfaces to get fields count \forcedlink{tuple_size}, \forcedlink{tuple_size_v}. 0021 /// 0022 /// \b Synopsis: 0023 namespace boost { namespace pfr { 0024 0025 BOOST_PFR_BEGIN_MODULE_EXPORT 0026 0027 /// Has a static const member variable `value` that contains fields count in a T. 0028 /// Works for any T that satisfies \aggregate. 0029 /// 0030 /// \b Example: 0031 /// \code 0032 /// std::array<int, boost::pfr::tuple_size<my_structure>::value > a; 0033 /// \endcode 0034 template <class T> 0035 using tuple_size = detail::size_t_< boost::pfr::detail::fields_count<T>() >; 0036 0037 0038 /// `tuple_size_v` is a template variable that contains fields count in a T and 0039 /// works for any T that satisfies \aggregate. 0040 /// 0041 /// \b Example: 0042 /// \code 0043 /// std::array<int, boost::pfr::tuple_size_v<my_structure> > a; 0044 /// \endcode 0045 template <class T> 0046 constexpr std::size_t tuple_size_v = tuple_size<T>::value; 0047 0048 BOOST_PFR_END_MODULE_EXPORT 0049 0050 }} // namespace boost::pfr 0051 0052 #endif // BOOST_PFR_TUPLE_SIZE_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |