literal_cast Class Template Reference
[Conversion Library]

#include <stlsoft/conversion/literal_cast.hpp>

List of all members.

Detailed Description

template<typename T, literal_cast_int_t V>
class stlsoft::literal_cast< T, V >

Provides compile-time validation for casts of literal values.

T The type to cast to
V The literal value to be cast
short s1 = stlsoft::literal_cast<short, 10>();          // Ok: 10 fits into short
short s2 = stlsoft::literal_cast<short, 1000000000>();  // Compile error: value too large for short

Thanks to Kevlin Henney ( for insights into the solution.

Public Member Functions

 operator T () const

The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:58:45 2010 for STLSoft by  doxygen 1.5.6