TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 227 subscribers
Post #23982 17
Templates, SFINAE, Concepts are counter-productive

Simple templates with little to no nesting is nice and ergonomic. But I often find myself wasting time and fighting with compiler whenever doing template meta programming. For example: https://stackoverflow.com/questions/76881423/is-there-a-way-to-retrieve-the-inner-types-of-a-type-using-variadic-templates-in
This solution works but it takes time to find that and the code is very wordy. Even though the idea of inner types is simple to explain to programmers.

SFINAE is horrible for compiler errors. In general template programming is also bad for errors. Are static_asserts the best we can do?

Concepts seems like it will cause more problems for me. Even more wordy and still bad compiled errors.

Should we go back to basics? What are we trying to solve? Isn't this just code generation? Can't we create a special scripting language for code gen? Allow access to compiler time data, type info, write any text to be compiled. Spit out custom error messages at compile time anywhere. Wouldn't that solve all my problems?

For context I'm working on game engines.

https://redd.it/1ny8eba
@r_cpp
Stack Overflow Is there a way to retrieve the inner types of a type using variadic templates in C++? Assume I have a type using variadic templates: template <typename... Args> struct Outer { // using Inner = something that captures ...Args ???; } How could I define Inner such that I could...
More from @r_cpp
  1. Oct 17, 2026MSVC Build Tools Version 14.52 Release Candidate Now Available https://devblogs.microsoft.…
  2. Oct 17, 2026C++ futures part 4: What if I want an immediate on-thread std::async? https://devblogs.mic…
  3. Oct 14, 2026I tested whether a coding agent would use C++23 ranges without being told Blog post: https…
  4. Oct 14, 2026C++ futures part 1: The mental model https://devblogs.microsoft.com/oldnewthing/20261012-0…
  5. Oct 14, 2026C++ futures part 2: The mental model for std::promise, std::packaged_task https://devblogs…
  6. Oct 12, 2026[Release] slick-logger v2.2.0 — Lock-free asynchronous C++20 logging with multi-process sh…
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 →