473,545 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loki::Factory and Loki::TList

Hi,

I read about the Loki::Factory and Loki::AbstractF actory 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<typena me T, const T myT>
class Derived : public Base
{
protected:
T _t;
}

Now I define the following TList:
TYPELIST_3(Deri ved<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::AbstractF actory or
Loki::Factory, or do I have to create my own?

Thanks in advance
Sebastian
Jul 19 '05 #1
0 2825

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1439
by: Michael Andersson | last post by:
Given a set of classes class A { enum [ ID = 0x0001} }; class B { enum [ ID = 0x0002} }; class B { enum [ ID = 0x0004} }; I wish to generate a composite class, perhaps using something like Alexandrescu's typelists (pseudo-code:)
7
1706
by: Erik | last post by:
private and protected members can only be accessed by deriving a class or by giving friendship. The problem with friendship is that friend statements are written inside the class. A FriendShip Policy solves the problem. There are different proposals how to solve the problem: The first idea is to provide the class with a macro...
5
2699
by: Jon Slaughter | last post by:
I'm having some issues using loki's typelists and I'm wondering if there is something I'm missing. I'm trying to create a template who's specialization sorta looks like template <int I, class T> struct Node { enum {Index = I}; typedef T Class;
0
401
by: Jon Slaughter | last post by:
For anyone, though I doubt anyone, who as been following my recent adventures with trying to do recursive templates it seems that I have finaly got everything to work out right. It actually ends up being very "elegant" one I was able to get a certain template to do most of the work. Anyways, wheres some code that shows the results(though...
3
1787
by: alex | last post by:
I read the Loki source code, I doubt why use ScatterHierarchyTag head? ---------------------------------------------------------------------------------------------------------------- namespace Private { template<class, class> struct ScatterHierarchyTag; }
0
1080
by: Dave Branton | last post by:
Hi, I've been using Loki-style typelists extensivley in my code for a while now, and have found them extremely useful, although somewhat annoying to specify due to all the close angle brackets required. Recently, though, I started using this syntax: //////////////////////////////////////////////////////////////////////////// struct...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7440
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5997
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.