Fixed bug 3509427 by adding use of Loki::TypeTraits.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1179 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2012-04-02 06:01:51 +00:00
parent 745e0efa2e
commit 42786afc4b
2 changed files with 6 additions and 5 deletions

View file

@ -44,6 +44,7 @@
#include <iostream> #include <iostream>
#include <loki/LokiExport.h> #include <loki/LokiExport.h>
#include <loki/TypeTraits.h>
// long is 32 bit on 64-bit Windows! // long is 32 bit on 64-bit Windows!
@ -132,7 +133,7 @@ namespace Loki
another device type. It is not for public use. another device type. It is not for public use.
*/ */
template < class Device2 > template < class Device2 >
PrintfState< Device2, Char > ChangeDevice( Device2 & device ) const PrintfState< Device2, Char > ChangeDevice( typename Loki::TypeTraits< Device2 >::ParameterType device ) const
{ {
return PrintfState< Device2, Char >( device, format_, width_, prec_, flags_, result_ ); return PrintfState< Device2, Char >( device, format_, width_, prec_, flags_, result_ );
} }

View file

@ -70,7 +70,7 @@ namespace Loki
const PrintfState< ::std::string &, char > state1( buffer, format ); const PrintfState< ::std::string &, char > state1( buffer, format );
::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout );
::std::FILE * f = stdout; ::std::FILE * f = stdout;
PrintfState< std::FILE *, char > printState2( state1.ChangeDevice( f ) ); PrintfState< std::FILE *, char > printState2( state1.ChangeDevice< ::std::FILE * >( f ) );
return printState2; return printState2;
} }
@ -79,7 +79,7 @@ namespace Loki
const PrintfState< ::std::string &, char > state1( buffer, format.c_str() ); const PrintfState< ::std::string &, char > state1( buffer, format.c_str() );
::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), stdout );
::std::FILE * f = stdout; ::std::FILE * f = stdout;
PrintfState< std::FILE *, char > printState2( state1.ChangeDevice( f ) ); PrintfState< std::FILE *, char > printState2( state1.ChangeDevice< ::std::FILE * >( f ) );
return printState2; return printState2;
} }
@ -87,7 +87,7 @@ namespace Loki
::std::string buffer; ::std::string buffer;
const PrintfState< ::std::string &, char > state1( buffer, format ); const PrintfState< ::std::string &, char > state1( buffer, format );
::std::fwrite( buffer.c_str(), 1, buffer.size(), f ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), f );
PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice( f ); PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice< ::std::FILE * >( f );
return printState2; return printState2;
} }
@ -95,7 +95,7 @@ namespace Loki
::std::string buffer; ::std::string buffer;
const PrintfState< ::std::string &, char > state1( buffer, format.c_str() ); const PrintfState< ::std::string &, char > state1( buffer, format.c_str() );
::std::fwrite( buffer.c_str(), 1, buffer.size(), f ); ::std::fwrite( buffer.c_str(), 1, buffer.size(), f );
PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice( f ); PrintfState< std::FILE *, char > printState2 = state1.ChangeDevice< ::std::FILE * >( f );
return printState2; return printState2;
} }