Archive

Posts Tagged ‘tmp’

Compile-time binary literals [via pseudorandom noise]

November 28, 2011 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.

Follow

Get every new post delivered to your Inbox.