9 Oct
2008
9 Oct
'08
4:56 p.m.
hello, class parameters { public: parameters(); ~parameters(); const R& getR() const; void setR(const R& rhs); const V& getV() const; void setV(const V& rhs); private: const R* r_; const V* v_; }; R and V are typedefs of variant<>. I have chosen to make the private members r_ and v_ as pointers to allow for r_=0 and v_=0 (is this a "never do this" thing?). R setter is implemented like this: void parameters::setR(const R& rhs) { if (!r_) r_ = new R( rhs ); else *r_ = rhs; } then ~parameters() { if (r_) delete r_; } There is no operator= for variant<> it seems? regards,