#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: | 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.
The current behavior the desired bahavior to preserve const-correctness. In a future version, const overloads can return boost::move_ptr<const T>.
-Thorsten