Re: [boost] Re: Object Factory

2002-11-21 Thread Anthony Liguori
Peter Dimov wrote: template struct constructor { template T * operator()(A1 const & a1) { return new T(a1); } }; FactoryA b = constructor(); Didn't even think to exploit the fact that function is assignable to function :) I only have one problem with this approach. The fact

Re: [boost] Re: Object Factory

2002-11-21 Thread Peter Dimov
From: "Anthony Liguori" <[EMAIL PROTECTED]> [...] > So I wrote up a class that provided virtual constructor functionality. > It actually allows for types to be treated as objects including storing > types in any STL container. This allows for really advanced factory > algorithms and all sorts

Re: [boost] Re: Object Factory

2002-11-20 Thread David Abrahams
Anthony Liguori <[EMAIL PROTECTED]> writes: > David Abrahams wrote: > >>Now can we rename "factory" to "metaclass"? I just want to see smoke >>come out of peoples' ears! >> > You know, this might be possible... If we can find a way to map > members to function objects somewhat automatically, Wh

Re: [boost] Re: Object Factory

2002-11-19 Thread Anthony Liguori
David Abrahams wrote: Now can we rename "factory" to "metaclass"? I just want to see smoke come out of peoples' ears! You know, this might be possible... If we can find a way to map members to function objects somewhat automatically, this might be realistic. After that, it's a simple sed sc

Re: [boost] Re: Object Factory

2002-11-19 Thread David Abrahams
Anthony Liguori <[EMAIL PROTECTED]> writes: > One thing has always bothered me about Loki's class factories > (namely, one paragraph in Modern C++ Design). The fact that virtual > constructions aren't considered possible in C++. Specifically, in > chapter 8.2 where Andrei gives an example of cod

Re: [boost] Re: Object Factory

2002-11-19 Thread Anthony Liguori
One thing has always bothered me about Loki's class factories (namely, one paragraph in Modern C++ Design). The fact that virtual constructions aren't considered possible in C++. Specifically, in chapter 8.2 where Andrei gives an example of code that doesn't work in C++: // Warning-this is N