STL array method summary (2) Capacity and modifiers (21)

Source: Internet
Author: User
Here is a summary of the array method. For details, refer to the following link:
Public member function <array> STD: array: Size
constexpr size_type size() noexcept;
Returns the number of elements in the array. Parametersnone
Return Value

The number of elements in array.

Address: http://blog.csdn.net/qq844352155/article/details/38944721




---------------------------------------------------

Public member function <array> STD: array: max_size
constexpr size_type max_size() noexcept;
Returns the maximum number of elements that an array container can store. Max_size of array is as big as size, which is generally equal to the second template parameter during instantiation. (Unlike vector)
Parametersnone
Return Value

Returns the maximum number of elements that an array can store,

This is a constant.

Address: http://blog.csdn.net/qq844352155/article/details/38943923


------------------------------------------------- Public member function <array> STD: array: empty
constexpr bool empty() noexcept;
Test whether array is empty. Parametersnone
Return Value

Returns true if array size is 0; otherwise, returns false.

Address: http://blog.csdn.net/qq844352155/article/details/38879921




---------------------------------------------------

Public member function <array> STD: array: Fill
void fill (const value_type& val);
Set Val to the values of all elements in array. Parameters
Val

Val is used to fill in the array value.

Return Value

None if the element value assignment throws an exception, it throws an exception.
Address: http://blog.csdn.net/qq844352155/article/details/38943777


__________________________________________________________________________________________________ Public member function <array> STD: array: swap
void swap (array& x) noexcept(noexcept(swap(declval<value_type&>(),declval<value_type&>())));

Exchanges content with X, which is an array of the same type (including the size ).

Parameters
X

X is an array of the same type (the same size), and the array to be exchanged with this array.

Return valuenone.

Address: http://blog.csdn.net/qq844352155/article/details/38944863


------------------------------------------------------------------

// Please give me more guidance on the bad summary. You can leave a message below or click the email address in the upper-left corner to send an email to me, pointing out my errors and shortcomings, so that I can modify them, thank you for sharing it.

Reprinted please indicate the source: http://blog.csdn.net/qq844352155
Author: unparalleled

Email: [email protected]

November

Yu gdut

------------------------------------------------------------------







STL array method summary (2) Capacity and modifiers (21)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.