Teuchos::ValueTypeConversionTraits< TypeTo, TypeFrom > Class Template Reference
[Teuchos Language Support Utilities]

Default traits class for all conversions of value types. More...

#include <Teuchos_as.hpp>

List of all members.

Static Public Member Functions

static TypeTo convert (const TypeFrom t)
static TypeTo safeConvert (const TypeFrom t)

Detailed Description

template<class TypeTo, class TypeFrom>
class Teuchos::ValueTypeConversionTraits< TypeTo, TypeFrom >

Default traits class for all conversions of value types.

This class should never be called directly by clients. Instead, use the as() and asSafe() template functions.

This default traits class simply does an implicit type conversion. Therefore, any conversions that are built into the language and are safe do not need a traits class specialization and should not generate any compiler warnings. For example, the conversions float to double, short type to type, type to long type, and an enum value to int are all always value preserving and should never result in a compiler warning or any aberrant runtime behavior.

All other conversions that cause compiler warnings and/or could result in aberrant runtime behavior (e.g. type to and from unsigned type, to and from floating point and integral types, etc.), or do not have compiler defined conversions (e.g. std::string to int, double etc.) should be given specializations of this class template. If an unsafe or non-supported conversion is requested by a client (i.e. through as() or asSafe()) then this default traits class will be instantiated and the compiler will either generate a warning message (if the conversion is supported but is unsafe) or will not compile the code (if the conversion is not supported by default in C++). When this happens, a specialization can be added or the client code can be changed to avoid the conversion.

Definition at line 67 of file Teuchos_as.hpp.

The documentation for this class was generated from the following file:
Generated on Wed May 12 21:24:42 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7