Recently I had a class that looked like
class IGraphElement{
typedef void FuncCharPtr(char*, int) ;
public:
void Add(FuncCharPtr* f)
{
FuncVec.push_back(f);
}
void CastData(char * data, int length){
for(size_t i = 0 ; i < FuncVec.size(); i++){
char* dataCopy = new char[length];
memcpy(dataCopy, data, length);
FuncVec[i](dataCopy, length);
}
}
private:
vector<FuncCharPtr*> FuncVec ;
};
There I was giving to all subscribers a pointer to there copy of data. Now I want to make my class to use boost. I understand that with boost I will be free from typedef and vector instead I would have something like
class IGraphElement{
public:
signal<void (char*, int) > SigB;
but how shall be CastData rewritten for me to keep controll over data which will be sent/casted to subscribers?