Loki::Factory and Loki::TList

S

Sebastian Faust

Hi,

I read about the Loki::Factory and Loki::AbstractFactory in the book Modern
C++ Design and couldnt figure out one thing:
If I have several classes, for example the following hierarchie:

clase Base
{
public:
Base(Base* pBase) : _pBase(pBase) { }
protected:
Base* _pBase;
};

template<typename T, const T myT>
class Derived : public Base
{
protected:
T _t;
}

Now I define the following TList:
TYPELIST_3(Derived<int, 1>, Derived<string, "Hello">, Derived<int, 9>)
my_list;

And now I wanna create all the Objects in in the List connected in the chain
of responsibility, that means after the creation I wanna have the following
structure:
Derived<int, 1> --> Derived<string, "Hello"> --> Derived<int, 9> --> NULL
And the factory should return to me a pointer to the beginning so that means
to: Derived<int, 1>.

Ist such a behavior possible with the Loki::AbstractFactory or
Loki::Factory, or do I have to create my own?

Thanks in advance
Sebastian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top