What is the most striking use of templates you've ever met?

We all know the usual use of patterns for container design, and we all know that you can do something with patterns that make your head spin.

When I first started static polymorphism, I was really amazed at what you can do with templates. Obviously, templates are not only useful for container design. I bought Andrey "Modern C + Design", but unfortunately I have not found the time or concentration to read it, but I am sure that it offers many brilliant applications of templates.

IMHO this> is also a very smart use of templates.

What is the most ingenious use of templates you've ever come across?

+3
source share
6 answers

boost Spirit meta-programming to create a parser grammar.

+5
source

, . , , .

+4

Alexandrescu , . Loki , .

+2

Microsoft " ", , COM , , .

+1

lib, , , , . , , . , , , . , - = 1 = -1. - = 1, = -2. , , . , < 1, -1,0 > , - < 0,1,0 > , x - < 1 + 0,1 + -1,0 + 0 > , * → .

Not only is he smart, but also one of the few examples of good use of templates with parameters other than typename

+1
source

Source: https://habr.com/ru/post/1707141/


All Articles