-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
32 lines (24 loc) · 1.16 KB
/
README
File metadata and controls
32 lines (24 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
make_array() - create a fixed size array
--- Introduction ---
The make_array() function constructs a fixed size boost::array<> given 0..N
arguments. It is similar to the std::make_pair() and std::make_tuple()
functions.
--- Interface ---
The make_array() function provides the following interface:
template<class T>
boost::array<T, N> make_array(...)
where the '...' indicates 0 to N arguments.
If no type T is passed explicitly it is deduced to be the type common to all of
the arguments (via boost::common_type<>). The function requires that all of the
arguments be convertible (via static_cast<>) to the explicit type T or the
deduced type.
--- Examples ---
// create 2-component array of type int
boost::array<int, 2> a = boost::make_array(4, 2);
// create 3-component array of type float given int arguments
boost::array<float, 3> = boost::make_array<float>(1, 2, 3);
--- Implementation Details ---
The make_array() function is implemented with C++11 variadic templates if they
are supported by the compiler. Otherwise a fallback implementation uses the
preprocessor to create N overloads of make_array() where N is defined by
BOOST_MAKE_ARRAY_MAX_ARITY (with a default of 10).