J
Jim Langston
Following does not compile for good reason(s).
template <class t>
GLvoid jglPrint( const jglFont& font, t text, jglVertex2& position ) {
// ...
if ( typeid( t ) == typeid( const char* ) )
std::basic_string <char> buffer( text );
else if ( typeid( t ) == typeid( const wchar_t * ) )
std::basic_string <wchar_t> buffer(text);
Basically I am accepting a few types for text anything that resembles text.
char*, const char*, wchar_t*, std::basic_string<wchar_t>, etc..
I want to declare my buffer containing the same basic type as text (char,
wchar_t, u16, etc..). I can't quite figure out the syntax. I'm fairly sure
it can be done but I hope in some elegant manner. Any suggestions?
template <class t>
GLvoid jglPrint( const jglFont& font, t text, jglVertex2& position ) {
// ...
if ( typeid( t ) == typeid( const char* ) )
std::basic_string <char> buffer( text );
else if ( typeid( t ) == typeid( const wchar_t * ) )
std::basic_string <wchar_t> buffer(text);
Basically I am accepting a few types for text anything that resembles text.
char*, const char*, wchar_t*, std::basic_string<wchar_t>, etc..
I want to declare my buffer containing the same basic type as text (char,
wchar_t, u16, etc..). I can't quite figure out the syntax. I'm fairly sure
it can be done but I hope in some elegant manner. Any suggestions?