Boost logo

Boost Users :

From: Oliver Mutz (mutz_at_[hidden])
Date: 2006-03-29 06:21:17


boost-users-bounces_at_[hidden] wrote:
>
> Is there any way that, using Boost, you can dynamically create classes by
> name, similar to the MFC RUNTIME_CLASS macros? I was hoping that the
> boost::serialize libs might be able to help with this.
>
> For example, I want to be able to do something like:
>
> CMyClass* pClass = CREATE_CLASS_BY_NAME("CMyClass");
>
> Can Boost help me to achieve this?

Is there any problem in using a conventional Factory solution and writing
the macro yourself?

I would suggest using the factory template introduced by Andrei Alexandrescu
in his book "Modern C++ Design" and available with the Loki lib.
See 'http://sourceforge.net/projects/loki-lib/' for details.

Oliver


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net