From: "Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]>
>
> I did not use boost::shared_array to implement the shared_plain<T> type
because
> one of our requirements is that one reference count can be used to manage
> multiple types. This is required in the context of in-place fast Fourier
> transforms. I.e. an array that starts out as
shared_plain<std::complex<double>
> > ends up as shared<double> after the Fourier transformation or vice
versa. Of
> course, constructing an array with type T and destructing it while
thinking of
> it as containing element types U could potentially lead to disasters. To
> provide a certain degree of protection type casts are therefore only
allowed
> for element types with trivial destructors. This is managed through type
traits
> that can be specialized by the user.

On most platforms, if you reinterpret_cast a shared_array< complex<double> >
to shared_array< double >, it will still destroy itself properly. (magic!)

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to