std::experi...ectSequence(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

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