Voilà, j'ai une fonction template qui fonctionne très bien toute seule, mais dés que je l'inclue dans une classe, j'ai une erreur de spécialisation ...
Le header de ma classe (avec les includes) :#include "..\C_CommunicationMySQL\C_CommunicationMySQL.h"
#include "..\Structures\Structures.h"
#include <string>
#include <sstream>
using namespace std;
class C_CommSysSqlMS : protected C_CommunicationMySQL
{
private :
Struct_Sorties Sorties;
public :
C_CommSysSqlMS();
~C_CommSysSqlMS();
template <typename T> string to_string( const T &Value); bool b_RecupSorties();
bool b_EnvoiEntrees(Struct_Entrees Entrees);
bool b_EnvoiHisto(Struct_Entrees Entrees);
Struct_Sorties SS_ShowSorties();
};
Le corps du template :template <typename T> string C_CommSysSqlMS::to_string(const T &Value)
{
stringstream streamOut;
streamOut << Value;
return streamOut.str( );
}
Appel de la fonction template :
string s=to_string(10); // exemple
Erreur :error C2893: Failed to specialize function template 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>
> __thiscall C_CommSysSqlMS::to_string(const T &)'
With the following template arguments:
'int'
Voilà, si quelqu'un peut me dire se qui ne va pas, ca m'aiderais beaucoup !
