C++ Templates

Discussions center on C++ templates for generic programming and metaprogramming, including their power, error messages, comparisons to generics in other languages, and whether they solve or create problems.

➡️ Stable 0.6x Programming Languages
3,938
Comments
20
Years Active
5
Top Authors
#8847
Topic ID

Activity Over Time

2007
5
2008
2
2009
39
2010
60
2011
62
2012
102
2013
122
2014
197
2015
203
2016
266
2017
284
2018
296
2019
268
2020
409
2021
352
2022
365
2023
275
2024
277
2025
342
2026
12

Keywords

MPL std.org stackoverflow.com DirectCompute TMP SFINAE simplestatictyperegistry.hpp emarcus.org youtube.com github.com templates template macros generic type error messages programming std error syntax

Sample Comments

kevin_thibedeau May 20, 2023 View on HN

It gives generic programming. C++ templates aren't the only possible implementation.

constantcrying Jul 30, 2023 View on HN

Just use C++ with just templates?

pif Nov 16, 2023 View on HN

You don't need a new programming language for something that C++ templates with integer constants give you for free.

ramon156 Jul 1, 2025 View on HN

Templates are a solution for a problem that c++ themselves created

pharmakom May 23, 2022 View on HN

Just look at any template heavy c++ library.

sitkack Sep 6, 2019 View on HN

If ever I heard a reason to use C++ templates, this is it.

shaklee3 Sep 1, 2019 View on HN

Are there languages that have powerful template metaprogramming that are much faster to compile?

maxxxxx Jan 10, 2019 View on HN

I am not up to date with latest C++ developments but I wonder if there is something you could build with template magic that would provide this in C++.

gdy Aug 25, 2013 View on HN

It is not necessarily so for C++, thanks to its templates.

int_19h Jul 13, 2017 View on HN

C++ doesn't have generics, it has templates, which are effectively a syntax-constrained form of macros. That's why it lends itself to abuse (or creative use, depending on your take on macros).