Archives for: "May 2014, 17"

C++: < type_traits > header

general, CodeProject, C++, Alchemy, design Send feedback »

For this entry, I would like to introduce the type_traits header file. This file contains utility templates that greatly simplify work when writing template-based libraries. This is especially true for libraries that employ template meta-programming. The header file is available with C++ TR1 and above. This library provides tools to identify types, their qualifying properties and even peel-off properties one-by-one programmatically at compile-time. There are also transformation meta-functions that provide basic meta-programming operations such as a compile-time conditional.

The definitions in type_traits will save us a lot of time implementing Alchemy. As I introduce some of the tools that are available in the header, I will also demonstrate how these operations can be implemented. This will help you understand how to construct variations of the same type of solution when applying it in a different context. As an example of this, I will create a construct that behaves similarly to the tertiary operator, but is evaluated at compile-time.

Full story »

Contact / Help. ©2017 by Paul Watt; Charon adapted from work by daroz. blogging software / hosting.
Design & icons by N.Design Studio. Skin by Tender Feelings / Skin Faktory.