|
Boost Users : |
Subject: Re: [Boost-users] can't extend boost::any on windows
From: Michael Linck (mgl_at_[hidden])
Date: 2008-12-16 14:02:14
> msvc gets the copy constructor and assignment operator wrong in
> the presence of a templated base class constructor/assignment operator.
>
> You need to define them explicitly.
>
> class Value : public boost::any {
> public:
> // <snip>
> Value(const Value& arg) : boost::any(static_cast<const
> boost::any&>(arg)){}
> Value& operator=(const Value& arg) {
> static_cast<Value&>(*this) = static_cast<const boost::any&>(arg);
> }
> };
thanks, I was trying to do about the same thing, but using
reinterpret_cast, which also caused unrecoverable errors. I guess I'm
not sure what the semantic difference between the two is, but that's
probably a question for a different list and a different day. In the
meantime, I made my type non-copyable, wrapped it in shared_ptrs which
is faster anyway, and got it working that way. But your I definitely
appreciate the answer since that would have been bugging me for days
otherwise.
mike
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