This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.
vector::data no longer returns a raw pointerSection: 23.3.13.4[vector.data]Status:C++11Submitter: Alisdair MeredithOpened: 2010-02-07Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [vector.data].
View all issues withC++11 status.
Discussion:
The original intent ofvector::data was to matcharray::datain providing a simple API with direct access to the contiguous buffer ofelements that could be passed to a "classic" C API. At some point, the returntype became the 'pointer' typedef, which is not derived from theallocator via allocator traits - it is no longer specified to preciselyT *. The return type of this function should be corrected to no longeruse the typedef.
[2010-02-10 Moved to Tentatively Ready after 5 positive votes on c++std-lib.]
Proposed resolution:
23.3.13[vector]
Update the class definition in p2:
// 23.3.6.3 data accesspointerT * data();const_pointerconst T * data() const;
23.3.13.4[vector.data]
Adjust signatures:
pointerT * data();const_pointerconst T * data() const;