Tag Archives: variadic templates

Generalised type-deduction for class template instance construction

I’ll wager that most C++ developers with experience of templates have at some point discovered the limitation that a class template’s parameters cannot be deduced in construction. Since type deduction can be performed in invocation of a function template however, I … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Compile-time binary literals [via pseudorandom noise]

This is a great post that shows off the new user-defined literals feature in C++11, using it to implement binary number literals such as 1011101010111110_binary. Paul also shows off some great template metaprogramming to achieve this end including template specialization, variadic templates (with template parameter packs and template recursion), and the sizeof… operator, which I’d not previously come across.

Quite a collection of features to discuss in one post, but done clearly and cohesively.

Continue reading

Link | Posted on by | Tagged , , , , , , | Leave a comment