Skip to content

Commit 483fab3

Browse files
committed
Consider explicit types for SmallVector variadic constructor
1 parent f90122a commit 483fab3

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ArrayUtils",
3-
"version": "1.3.8",
3+
"version": "1.3.9",
44
"description": "Helps to create complex arrays and maps as arrays of pairs",
55
"keywords": "array, map, vector, queue, pair",
66
"repository":

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=vovagorodok_ArrayUtils
2-
version=1.3.8
2+
version=1.3.9
33
author=vovagorodok
44
maintainer=vovagorodok <vovagorodok2@gmail.com>
55
sentence=Helps to create complex arrays and maps as arrays of pairs

src/SmallVector.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class SmallVector
99
constexpr SmallVector() : _arr(), _size() {
1010
}
1111
template <typename... OtherT>
12-
constexpr SmallVector(OtherT&&... args) : _arr{args...}, _size(sizeof...(args)) {
12+
constexpr SmallVector(OtherT&&... args) : _arr(), _size() {
13+
static_assert(sizeof...(args) <= N);
14+
((_arr[_size++] = T(std::forward<OtherT>(args))), ...);
1315
}
1416
constexpr std::size_t capacity() const {
1517
return N;

0 commit comments

Comments
 (0)