GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
deductionguidesforstd::array(3) C++ Standard Libary deductionguidesforstd::array(3)

deductionguidesforstd::array - deductionguidesforstd::array


Defined in header <array>
template <class T, class... U> (since C++17)
array(T, U...) -> array<T, 1 + sizeof...(U)>;


One deduction guide is provided for std::array to provide an equivalent of
std::experimental::make_array for construction of std::array from a variadic
parameter pack.


The program is ill-formed if (std::is_same_v<T, U> && ...) is not true. Note that
(std::is_same_v<T, U> && ...) is true when sizeof...(U) is zero.

// Run this code


#include <array>
#include <cassert>


int main()
{
int const x = 10;
std::array a{1, 2, 3, 5, x}; // OK, creates std::array<int, 5>
assert(a.back() == x);


// std::array b{1, 2u}; // Error, all arguments must have same type


// std::array<short> c{3, 2, 1}; // Error, wrong number of template args
std::array c(std::to_array<short>({3, 2, 1})); // C++20 alternative, creates std::array<short, 3>
}

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.