# std::experimental::basic_string_view<CharT,Traits>::data

> C++ Atlas: `cppatlas.com/w/cpp/experimental/basic_string_view/data` | Source: https://en.cppreference.com/w/cpp/experimental/basic_string_view/data | Domain: Technical specifications

Returns a pointer to the underlying character array. The pointer is such that the range [data(), data() + size()) is valid and the values in it correspond to the values of the view.

## Official Specification Summary (cppreference)

```cpp
constexpr const_pointer data() const noexcept; // (library fundamentals TS)
```

Returns a pointer to the underlying character array. The pointer is such that the range [data(), data() + size()) is valid and the values in it correspond to the values of the view. (n.b. Unlike `basic_string::data()` and string literals, `data()` may return a pointer to a buffer that is not null-terminated. Therefore it is typically a mistake to pass `data()` to a routine that takes just a `const CharT*` and expects a null-terminated string.)

### Parameters

(none)

### Return value

A pointer to the underlying character array.

### Complexity

Constant.

### See also

- [`front`](https://en.cppreference.com/w/cpp/experimental/basic_string_view/front): accesses the first character (public member function)
- [`back`](https://en.cppreference.com/w/cpp/experimental/basic_string_view/back): accesses the last character (public member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/experimental/basic_string_view/data (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.