Files
cppdraft_translate/cppdraft/array/members.md
2025-10-25 03:02:53 +03:00

69 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[array.members]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#array.members)
### 23.3.3 Class template array [[array]](array#members)
#### 23.3.3.3 Member functions [array.members]
[🔗](#lib:array,size)
`constexpr size_type size() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6247)
*Returns*: N[.](#1.sentence-1)
[🔗](#lib:array,data)
`constexpr T* data() noexcept;
constexpr const T* data() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6259)
*Returns*: A pointer such that [data(), data() + size()) is a valid range[.](#2.sentence-1)
For a
non-empty array, data() == addressof(front()) is true[.](#2.sentence-2)
[🔗](#lib:array,fill)
`constexpr void fill(const T& u);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6271)
*Effects*: As if by fill_n(begin(), N, u)[.](#3.sentence-1)
[🔗](#lib:array,swap)
`constexpr void swap(array& y) noexcept(is_nothrow_swappable_v<T>);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6282)
*Effects*: Equivalent to swap_ranges(begin(), end(), y.begin())[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6286)
[*Note [1](#note-1)*:
Unlike the swap function for other containers, array::swap takes linear time, can exit via an exception, and does not cause iterators to
become associated with the other container[.](#5.sentence-1)
— *end note*]