About Store Forum Documentation Contact



Post Reply 
Memb problem
Author Message
Brainache Offline
Member

Post: #1
Memb problem
Hey there... I have encounterd a problem with using Memb to replace the STL vector class.... I've hit this same issue using other memory container replacements also...

The problem is when I attempt to add a Memb to a Memb...

For example:
Code:
class cPath
{
Str name;
};

class cStage
{
Memb<cPath> paths;
};

class cDialog
{
Memb<cStage> stages;

void addStage()
{
cStage s;
// the following will not allow a compile, remove it and its fine...
stages.add(s);  
}

};

The error is: error C2783: 'void Esenthel::Memb<TYPE>::operator =(Esenthel::Memb<TYPE> &)' : could not deduce template argument for 'TYPE'

Is there a workaround for nested Memb structures?

Thanks!
12-29-2008 09:39 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
Re: Memb problem
this action requires copy constructors (which are disabled for Memory Containers)

instead of the lines
Code:
cStage s;
// the following will not allow a compile, remove it and its fine...
stages.add(s);
you can do the following (which is faster) :
Code:
cStage &s=stages.New();
// and then operate on 's'
12-29-2008 09:55 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #3
Re: Memb problem
Awesome... works like a charm!
12-29-2008 10:26 PM
Find all posts by this user Quote this message in a reply
Post Reply