Skip to content

Update <array> functions reference - #5684

Merged
Diana Richards (v-dirichards) merged 7 commits into
MicrosoftDocs:mainfrom
Rageking8:update-array-functions-reference
Jan 27, 2026
Merged

Diana Richards (v-dirichards) merged 7 commits into
MicrosoftDocs:mainfrom
Rageking8:update-array-functions-reference

Conversation

@Rageking8

@Rageking8 Rageking8 commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

Overall changes

  • Make template parameter names more readable
  • Add bunch of std:: and "Template parameters" headings
  • Simplify single "See also" link and update metadata

get

  • Add missing const&& overload
Overload # microsoft/STL cplusplus/draft
1 stl/inc/array#L852-L853 source/containers.tex#L6099-L6100
2 stl/inc/array#L866-L867 source/containers.tex#L6103-L6104
3 stl/inc/array#L876-L877 source/containers.tex#L6101-L6102
4 stl/inc/array#L890-L891 source/containers.tex#L6105-L6106

swap

  • For now, I skipped the noexcept specification introduced in C++17 as I need more time to think how to best represent it
Overload # microsoft/STL cplusplus/draft
1 stl/inc/array#L771-L772 source/containers.tex#L6083-L6084

to_array

  • Document C++20 std::to_array function
  • In the example output, the trailing spaces are preserved but the NUL character is stripped to prevent issues
Overload # microsoft/STL cplusplus/draft
1 stl/inc/array#L828-L829 source/containers.tex#L6087-L6088
2 stl/inc/array#L837-L838 source/containers.tex#L6089-L6090

@prmerger-automator

Copy link
Copy Markdown
Contributor

Rageking8 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit d1f2f14:

✅ Validation status: passed

File Status Preview URL Details
docs/standard-library/array-functions.md ✅Succeeded
docs/standard-library/array.md ✅Succeeded

For more details, please refer to the build report.

@prmerger-automator

Copy link
Copy Markdown
Contributor

PRMerger Results

Issue Description
File Change Percent This PR contains file(s) with more than 30% file change.

@v-regandowner

Copy link
Copy Markdown
Contributor

Tyler Whitney (@TylerMSFT) - Can you review the proposed changes?

IMPORTANT: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator Bot added the aq-pr-triaged Tracking label for the PR review team label Aug 20, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 added std:: prefixes throughout
  • Added documentation for the C++20 std::to_array function with examples
  • Added missing const&& overload for the get function
  • 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

Comment on lines +18 to +27
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

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +27
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

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +27
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

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +27
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

Copy link

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.

Copilot uses AI. Check for mistakes.
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit a1cd597:

✅ Validation status: passed

File Status Preview URL Details
docs/standard-library/array-functions.md ✅Succeeded
docs/standard-library/array.md ✅Succeeded

For more details, please refer to the build report.

@prmerger-automator

Copy link
Copy Markdown
Contributor

PRMerger Results

Issue Description
File Change Percent This PR contains file(s) with more than 30% file change.

@TylerMSFT Tyler Whitney (TylerMSFT) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the function and an example!

@TylerMSFT

Copy link
Copy Markdown
Collaborator

#sign-off

@v-dirichards
Diana Richards (v-dirichards) merged commit 7be9fda into MicrosoftDocs:main Jan 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants