add print_cast()

Cast value to "printable" type.
A no-op except for char types, which are cast to int
so that they are printed as numbers std::ostream operators.
This commit is contained in:
Michael Davidsaver
2013-07-29 11:42:33 -04:00
parent 0eecd3b1fe
commit e96b447e37

View File

@@ -159,6 +159,14 @@ static FORCE_INLINE TO castUnsafe(const FROM& from)
void castUnsafeV(size_t count, ScalarType to, void *dest, ScalarType from, const void *src);
//! Cast value to printable type
//! A no-op except for char types, which are cast to int
//! so that they are printed as numbers std::ostream operators.
template<typename T>
static FORCE_INLINE
typename detail::print_cast<T>::type
print_cast(const T& v) { return v; }
}} // end namespace
#endif // PVTYPECAST_H