-
Notifications
You must be signed in to change notification settings - Fork 982
Update <array> functions reference
#5684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update <array> functions reference
#5684
Conversation
|
@Rageking8 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit d1f2f14: ✅ Validation status: passed
For more details, please refer to the build report. |
PRMerger Results
|
|
@TylerMSFT - Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the <array> functions reference documentation to improve readability and completeness. The main purpose is to modernize the documentation with clearer template parameter names, consistent std:: prefixes, and addition of the missing C++20 std::to_array function.
Key changes:
- Modernized template parameter names (
T→Type,N→Size) and addedstd::prefixes throughout - Added documentation for the C++20
std::to_arrayfunction with examples - Added missing
const&&overload for thegetfunction - Reorganized parameter sections with separate "Template parameters" headings
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/standard-library/array.md | Added table entry for the new to_array function and updated metadata |
| docs/standard-library/array-functions.md | Updated all function signatures with modern naming, added complete to_array documentation, and improved structure |
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
Overall changes
std::and "Template parameters" headingsgetconst&&overloadmicrosoft/STLcplusplus/draftstl/inc/array#L852-L853source/containers.tex#L6099-L6100stl/inc/array#L866-L867source/containers.tex#L6103-L6104stl/inc/array#L876-L877source/containers.tex#L6101-L6102stl/inc/array#L890-L891source/containers.tex#L6105-L6106swapnoexceptspecification introduced in C++17 as I need more time to think how to best represent itmicrosoft/STLcplusplus/draftstl/inc/array#L771-L772source/containers.tex#L6083-L6084to_arraystd::to_arrayfunctionmicrosoft/STLcplusplus/draftstl/inc/array#L828-L829source/containers.tex#L6087-L6088stl/inc/array#L837-L838source/containers.tex#L6089-L6090