jeudi 6 octobre 2022

Convert typdef into template

I have an overloaded function which accepts two different types of parameter (factorywv) as below. I am working under Solaris environment.

typedef AISObject *(*factorywv)();
namespace bcMwMrsh
{
 template<typename listT>
 void cppListFromWire(void *&src,RWTValSlist<listT> &dest, factorywv);
} 

int FormAccountSetupList::fromWire(void *&buf, long bufLen)
{
        bcMwMrsh::cppListFromWire(buf, contents, FormAccountSetupRow::AISFactory);
        return 0;
}

AISFactory and contents are defined as below,

static AISObject *AISFactory() { return new FormAccountSetupList; }
RWTValSlist<FormAccountSetupRow *> contents;

These two functions are called in different cpp files. Currently I am facing the below error and understood function template may solve the problem.

Undefined                       first referenced
 symbol                             in file
void bcMwMrsh::cppListFromWire<FormATMSetupRow*>(void*&, RWTValSlist<FormATMSetupRow*, std::allocator<FormATMSetupRow*> >&, AISObject* (*)()) actsetup.o

Could some one please let me know how can I convert the typdefs to templatized form? Or my understanding of the problem is correct?

Aucun commentaire:

Enregistrer un commentaire