Spirit - Cannot get my actors straight
Hi,
I'm trying to create a parser that shall create a number of derived
classes based on the input, put it in a shared_ptr<Base> and push_back
to a vector.
Example:
"Alpha" => vec.push_back(shared_ptr<Base>(new Alpha()))
"Beta[1]" => vec.push_back(shared_ptr<Base>(new Beta(1)))
"Gamma[2-3]" => vec.push_back(shared_ptr<Base>(new Gamma(2, 3)))
"Gamma[4-End]" => vec.push_back(shared_ptr<Base>(new Gamma(4)))
I've defined the actor as [push_back_a(self.vec, BasePtr(new Alpha()))],
but that obviously doesn't work as BasePtr(new Alpha()) creates a
temporary shared_ptr that will be destroyed by the end of the statement.
How can I delay the creation of the shared_ptr, and how can I delay the
new statement?
Using Boost 1.34.1, MSVC++ 2005.
Thanks,
Anders Dalvander
#include <vector>
#include
Anders Dalvander wrote:
Hi,
I'm trying to create a parser that shall create a number of derived classes based on the input, put it in a shared_ptr<Base> and push_back to a vector.
Hi, The proper forum is the Spirit list: https://lists.sourceforge.net/lists/listinfo/spirit-general see you there! Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (2)
-
Anders Dalvander
-
Joel de Guzman