Title
vector::data no longer returns a raw pointer
Status
c++11
Section
[vector.data]
Submitter
Alisdair Meredith

Created on 2010-02-07.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

[vector]

Update the class definition in p2:

// 23.3.6.3 data access
pointerT * data();
const_pointerconst T * data() const;

[vector.data]

Adjust signatures:

pointerT * data();
const_pointerconst T * data() const;
Date: 2010-02-10.00:00:00

[ 2010-02-10 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2010-02-07.00:00:00

The original intent of vector::data was to match array::data in providing a simple API with direct access to the contiguous buffer of elements that could be passed to a "classic" C API. At some point, the return type became the 'pointer' typedef, which is not derived from the allocator via allocator traits - it is no longer specified to precisely T *. The return type of this function should be corrected to no longer use the typedef.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg1557
2010-10-21 18:28:33adminsetmessages: + msg1556
2010-02-07 00:00:00admincreate