As I have a class like:
class Test {
void setVersion(Version *version);
Version* version() const;
private:
Version *m_version;
};
which I adapted using BOOST_FUSION_ADAPT_ADT I'd like to know how I could write grammar rules which return Version objects on heap without leaking on failing. One way I've discovered is to use
[_val = phoenix::new_<Version>(Version(0))]
in semantic actions but this seems rather like a dirty workaround to me. Note that usually I wouldn't use heap allocated objects but in this case the API with pointers is already fixed that way.