Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-02-18 18:30:07


David B. Held wrote:
[snip]
> I realize that the operator ought to be const. But should the reference
> be? I guess I don't know if you should be able to call a d'tor on a
> const& or not.

My understanding is that since the following is legal...

  const T* p = ...;
  delete p;

...so is what you see in variant.hpp:

  const T& r = ...;
  r.~T();

Even if my understanding is correct though, it may be best for destroyer to
take a non-const reference to avoid confusion.

Anyone?

Thanks,
Eric


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk