Pawel: >>> I want to ahve any number of instances of an app. >>> >>> I can use an array (and am using one for now) but a vector or list >>> would be better (given the dynamic resizing allowed by those). A >>> list also requires a copy constructor however. >>> >>> If someone has programmed in a copy constructor for FL_Window, or >>> can advise how to, then I'd love to know. Otherwise any advice on >>> how to have multiple instances of an app class (that inherits from >>> Fl_Window) would be good.
Me: >> Do you really need a vector<Fl_Window> ? >> Is it not possible to use a vector<Fl_Window*> ? >> >> IIRC, if you have a vector<Thing> then Thing has to have a default >> constructor with no parameters. Fl_Window has no such constructor. >> >> Rather than the hassle of trying to retro-fit a copy constructor >> through the Fl_Widget, Fl_Group, Fl_Window hierarchy and open up >> a big can of worms, why not introduce simpler redirection class. >> This class would only contain an Fl_Window* initialized to NULL/0 >> in the default constructor, and accessor methods that would create >> the real Fl_Window if needed. Lazy evaluation for Fl_Windows. Pawel: > I'll give this a go. If it interests you to sketch up a rough guess > in code that would be really good, because I am not completely sure > I've got what you mean.. What I had in mind was to use the Proxy design pattern to implement a lazy initialization scheme, as described for C# here (not C++): http://en.wikipedia.org/wiki/Lazy_loading BUT: the more that I think about it, the more I have to ask what it is that you really want. This pattern will allow you to use a vector<Fl_Window_Proxy> but you will require a lot more than just the lazy initialisation. If you provide a destructor for the Fl_Window_Proxy in order to delete the real Fl_Window, you will probably also need to provide a reference counting system, etc. D. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

