Subject: Re: [boost] [smart_ptr] No more shared_ptr<T>::value_type?
From: Andrew Hundt (athundt_at_[hidden])
Date: 2013-04-16 14:57:43
On Tue, Apr 16, 2013 at 1:45 PM, Peter Dimov <lists_at_[hidden]> wrote:
> As Nathan already pointed out, value_type has never been a documented part
> of shared_ptr's interface. It should never have been added in the first
> place. Containers, allocators and iterators have a value_type, and
> shared_ptr is none of those. In addition, even if we squint and view it as
> iterator-like, value_type is and has always been wrong - the value_type of
> a pointer to a const T must be T and not const T.
The value_type typedef wasn't marked as deprecated in a comment or any
other indication in the code itself. Of course the change is sensible, I
just believe that breaking changes of components in the most widely used
libraries in boost that have been present for multiple years are worth a
mention in the release notes. :-)
There are many interfaces and use cases all over boost that aren't in a
detail namespace or otherwise marked as internal implementation details
that are not mentioned or clear in the documentation :-) . They inevitably
end up getting used, and while I'm personally happy to update interfaces to
use improvements to libraries I've found around half the developers across
two completely different organizations that I've worked at will get
extremely grumpy if such changes don't come with adequate advanced notice.
Some will even go so far as to avoid using libraries entirely after one or
two breaking changes that cost them a lot of time. From their perspective I
understand that it is helpful to be able to know when to expect a 5 minute
boost update vs a 5 hour or even a 50 hour update.
Of course, I'm in favor of improvements that break existing interfaces to
make them better. I just want to convey some of the resistance I've
encountered while advocating for boost and while updating it.
You probably want element_type, although it depends on the specific case.
> shared_ptr<T>::element_type was always T before 1.53, but in 1.53
> shared_ptr<int>::element_**type is int and not int. This is not
> likely to be a problem in existing code, though.
Thanks! element_type worked for me.