std::experi...ectSequence(3)
okay bestie, welcome to std::experi...ectSequence(3) from the C++ Standard Libary manual β yes, thatβs the exact manual name, typo and all β and itβs giving reflection TS main character energy. π
β¨
π NAME π
std::experimental::reflect::ObjectSequence β std::experimental::reflect::ObjectSequence. Thatβs the name twice, fr fr. No notes. π
β¨ Synopsis β¨
Defined in header <experimental/reflect>. The synopsis vibe is:
template< class T > (reflection
TS)
concept ObjectSequence = Object<T> && /* see below */;
So the ObjectSequence concept is satisfied by meta-object sequence types. A meta-object sequence type is a meta-object type that is obtained from a meta-object operation that generates a sequence, e.g. get_data_members. Each element of a meta-object sequence type is a meta-object type. Lowkey thatβs the whole tea. π¦
πΈ Example πΈ
// Run this code
#include<cmath>
#include<experimental/reflect>
#include<tuple>
#include<type_traits>
namespace reflect = std::experimental::reflect;
template<reflect::Typed... Ms>
using tuple_from_seq_t = std::tuple<reflect::get_reflected_type_t<
reflect::get_type_t<Ms>>...>;
template<reflect::Record T>
using collect_tuple = reflect::unpack_sequence_t<
tuple_from_seq_t,
reflect::get_data_members_t<T>>;
int main()
{
static_assert(reflect::ObjectSequence<
reflect::get_data_members<reflexpr(std::div_t)>>,
"");
static_assert(std::is_same<collect_tuple<reflexpr(std::div_t)>,
std::tuple<int, int>>::value, "");
}
π See also π
This section is incomplete Reason: templatization
π·οΈ Category π·οΈ
- Todo with reason
mwah π source/version/date tea: http://cppreference.com, 2024.06.10, and this page is std::experi...ectSequence(3). Bye bestie β go slay your reflection TS. ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms