TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #25685 20
explicitly annotated members, so their indices must be exactly 0, 3). Member 'simple_tuple::c' uses index 3.

Example 3:

[[=tuple_element(0)]
[=tuple_element(1)]
long a;

/app/myreflectutils.hpp:632:21: error: static assertion failed: reflectutils: invalid tuple layout for 'simpletuple': member 'simpletuple::a' has 2 tuple annotations; use exactly one of [[=tupleelement(i)]] and [=read_only_tuple_element(i)].

Full code: https://godbolt.org/z/exjW6YGEr

https://redd.it/1v9u2d5
@r_cpp
godbolt.org Compiler Explorer - C++ (x86-64 gcc (trunk)) using namespace reflect_utils; struct [[=tuple_like]] simple_tuple { long a; int b; char c; }; static_assert(std::tuple_size_v<simple_tuple> == 3); constexpr simple_tuple simple { 1, 2, 3 }; static_assert(1 == get<0>(simple)); static_assert(2…
More from @r_cpp
  1. Sep 26, 2026Token Sequence Injection & Modern Macros: The Most Game-Changing Compile-Time Feature in C…
  2. Sep 25, 2026myStringStream.str("") Considered Harmful Under C++20 I was recently looking at some (rath…
  3. Sep 20, 2026A clever branch free optimization I'm the developer of memlz which is an extremely fast co…
  4. Sep 15, 2026Inside Boost.PolyCollection https://bannalia.blogspot.com/2026/09/inside-boostpolycollecti…
  5. Sep 11, 2026C++26: Standard Library Hardening Experiments https://www.cppstories.com/2026/hardening-ex…
  6. Sep 11, 2026MSVC C++23: constexpr cmath with LLVM Libc https://devblogs.microsoft.com/cppblog/msvc-c23…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →