memesearch
C++26 Reflection Syntax Looks Abhorrent

C++26 Reflection Syntax Looks Abhorrent

Download Find similar pictures
Text on the meme
C++26 reflection syntax looks abhorrent struct Range { int lo, hi; }; struct Config { [[=Range{.lo: 1, .hi: 65535}]] int port; [[=Range{.lo: 1, .hi: 256}]] int max_threads; [[=Range{.lo: 100, .hi: 30000}]] int timeout_ms; }; template <typename T> constexpr bool validate(const T& obj) { constexpr auto context = std::meta::access_context::current(); template for (constexpr auto member : define_static_array( r::nonstatic_data_members_of(^^T, context))) { template for (constexpr auto annotation : define_static_array( annotations_of_with_type<member, ^^Range>)) { auto [lo, hi] = extract<Range>(annotation); if (obj.[:member:] < lo || obj.[:member:] > hi) return false; } } return true; } static_assert(validate(Config{.port: 1000, .max_threads: 50, .timeout_ms: 20000})); static_assert(!validate(Config{.port: 0, .max_threads: 0, .timeout_ms: 0}));
What it means

The image shows a screenshot of C++26 reflection code with heavily complex syntax for validating annotated configuration fields. The joke is that modern C++ reflection looks so elaborate and unpleasant that it could compete for the “ugliest language” award alongside Rust. This meme is used as a sarcastic reaction to confusing language features or excessively complicated code. EN: The image shows a screenshot of C++26 reflection code with heavily complex syntax for validating annotated configuration fields. The joke is that modern C++ reflection looks so elaborate and unpleasant that it could compete for the “ugliest language” award alongside Rust. This meme is used as a sarcastic reaction to confusing language features or excessively complicated code.

Objects
Tags
Source
Type
image
Size
800×711 · 84.6 KiB
Mood
sarcastic, absurd
Language
en
Added

Similar memes