This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2596. `vector::data()` should use `addressof`

Section: 24.3.11.4 [vector.data] Status: C++17 Submitter: Marshall Clow Opened: 2016-02-29 Last modified: 2017-07-30

Priority: 0

View all other issues in [vector.data].

View all issues with C++17 status.

Discussion:

In 24.3.11.4 [vector.data], we have:

> Returns: A pointer such that `[data(),data() + size())` is a valid range. For a non-empty vector, `data() == &front()`.

This should be:

> Returns: A pointer such that `[data(),data() + size())` is a valid range. For a non-empty vector, `data() == addressof(front())`.

Proposed resolution:

This wording is relative to N4582.

1. Change 24.3.11.4 [vector.data] p1 as indicated:

   >     T* data() noexcept;
   >     const T* data() const noexcept;

   > > -1- Returns: A pointer such that `[data(), data() + size())` is a valid range. For a non-empty vector, `data() == addressof(&front())`.