Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:38

0001 // Copyright (c) 2016-2023 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 /// Has a static const member variable `value` that contains fields count in a T.
0026 /// Works for any T that satisfies \aggregate.
0027 ///
0028 /// \b Example:
0029 /// \code
0030 ///     std::array<int, boost::pfr::tuple_size<my_structure>::value > a;
0031 /// \endcode
0032 template <class T>
0033 using tuple_size = detail::size_t_< boost::pfr::detail::fields_count<T>() >;
0034 
0035 
0036 /// `tuple_size_v` is a template variable that contains fields count in a T and
0037 /// works for any T that satisfies \aggregate.
0038 ///
0039 /// \b Example:
0040 /// \code
0041 ///     std::array<int, boost::pfr::tuple_size_v<my_structure> > a;
0042 /// \endcode
0043 template <class T>
0044 constexpr std::size_t tuple_size_v = tuple_size<T>::value;
0045 
0046 }} // namespace boost::pfr
0047 
0048 #endif // BOOST_PFR_TUPLE_SIZE_HPP