Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3878 closed Bugs (wontfix)

"ptr_map<T>::auto_type const" acts like "std::auto_ptr<T const>" instead of "std::auto_ptr<T> const"

Reported by: ryan.gallagher@… Owned by: Thorsten Ottosen
Milestone: Boost 1.42.0 Component: ptr_container
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

the ptr_map<T>::auto_type doesn't act quite as much like std::auto_ptr<T> as the documentation declares. The reason is that it seems to follow container const semantics instead of pointer const semantics. Namely, "ptr_map<T>::auto_type const" acts more like "std::auto_ptr<T const>" instead of "std::auto_ptr<T> const". In reading the documentation I would have expected the latter instead of the former treatment of const on this type.

It should be considered which is the appropriate way to handle const for this type. If the existing behavior is desired then a note should be added to the documentation. If instead const pointer semantics are desirable then changing the code should be considered.

This may apply to other pointer containers as well, I haven't investigated this.

Change History (2)

comment:1 by Thorsten Ottosen, 12 years ago

Resolution: wontfix
Status: newclosed

The current behavior the desired bahavior to preserve const-correctness. In a future version, const overloads can return boost::move_ptr<const T>.

-Thorsten

comment:2 by ryan.gallagher@…, 12 years ago

Any chance of getting a note in the documentation on this then?

-Ryan

Note: See TracTickets for help on using tickets.