Title
Missing requirement for Allocator::pointer
Status
c++17
Section
[allocator.requirements]
Submitter
Jonathan Wakely

Created on 2013-05-14.00:00:00 last changed 89 months ago

Messages

Date: 2016-11-21.05:25:40

Proposed resolution:

  1. Edit Table 28 as indicated:

    Table 28 — Allocator requirements (continued)
    Expression Return type Assertion/note pre-/post-condition Default
    static_cast<X::const_pointer>(z) X::const_pointer static_cast<X::const_pointer>(z) == q  
    pointer_traits<X::pointer>::pointer_to(r) X::pointer    
Date: 2016-11-15.00:00:00

[ 2016-11-12, Issaquah ]

This is related to 1521.

Sat PM: Restore original P/R and move to tentatively ready.

Date: 2017-02-02.00:41:18

[ 2015-07 Telecon ]

Marshall to ping Pablo for proposed wording and disable current wording.

Previous resolution [SUPERSEDED]:
  1. Edit Table 28 as indicated:

    Table 28 — Allocator requirements (continued)
    Expression Return type Assertion/note pre-/post-condition Default
    static_cast<X::const_pointer>(z) X::const_pointer static_cast<X::const_pointer>(z) == q  
    pointer_traits<X::pointer>::pointer_to(r) X::pointer    
Date: 2015-09-27.20:55:06

[ 2013-09 Chicago ]

Pablo to come back with proposed wording

Date: 2013-05-14.00:00:00

For an allocator A<T> which defines A<T>::pointer to a class type, i.e. not T*, I see no requirement that A<T>::pointer is convertible to A<U>::pointer, even if T* is convertible to U*. Such conversions are needed in containers to convert from e.g. ListNodeBase* to ListNode<T>*.

The obvious way to do such conversions appears to be pointer_traits::pointer_to(), but that's ill-formed if the static member function A<T>::pointer::pointer_to() doesn't exist and the allocator requirements don't mention that function, so you need to cast A<T>::pointer to A<T>::void_pointer then cast that to A<U>::pointer.

Is converting via void_pointer really intended, or are we missing a requirement that pointer_traits<A<T>::pointer>::pointer_to() be well-formed?

Proposed resolution:

Add to the Allocator requirements table the following requirement:

The expression pointer_traits<XX::pointer>::pointer_to(r) is well-defined.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:41:16adminsetstatus: ready -> wp
2016-11-21 05:25:40adminsetmessages: + msg8676
2016-11-21 05:25:40adminsetmessages: + msg8675
2016-11-21 05:25:40adminsetstatus: open -> ready
2014-01-14 19:49:34adminsetmessages: + msg6795
2014-01-14 19:49:34adminsetstatus: new -> open
2013-06-29 15:11:00adminsetmessages: + msg6531
2013-05-14 00:00:00admincreate