C++26 Reflection introduces a single opaque type `std::meta::info` that can represent any language entity — types, class templates, values, and more. This turns out to give us 'universal template parameters' almost for free: a single function template parameterized on `meta::info` can accept `std::vector<int>`, `std::vector`, `std::ranges::subrange`, or any other template argument, something previously impossible without combinatorial overload sets. The post demonstrates this with a `meta_to` example and suggests that the dedicated P2989 'Universal template parameters' proposal may now be redundant.
3.2K Impressions