Quantcast
Channel: C++14 Variable Templates: what is their purpose? Any usage example? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

C++14 Variable Templates: what is their purpose? Any usage example?

$
0
0

C++14 will allow the creation of variables that are templated. The usual example is a variable 'pi' that can be read to get the value of the mathematical constant π for various types (3 for int; the closest value possible with float, etc.)

Besides that we can have this feature just by wrapping a variable within a templated struct or class, how does this mix with type conversions? I see some overlapping.

And other than the pi example, how would it work with non-const variables? Are there any usage examples to understand how to make the most of such a feature and what its purpose is?


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images