Skip to content

Commit 2c712e9

Browse files
committed
fix: null ptr to empty array
1 parent 342248f commit 2c712e9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tuple/include/array_tuple_sketch.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ class array {
3737
using alloc_traits = std::allocator_traits<Allocator>;
3838

3939
explicit array(uint8_t size, const T& value, const Allocator& allocator = Allocator()):
40-
allocator_(allocator), size_(size), array_(size_ == 0 ? nullptr : allocator_.allocate(size_)) {
40+
allocator_(allocator), size_(size), array_(allocator_.allocate(size_)) {
4141
for (uint8_t i = 0; i < size_; ++i) {
4242
alloc_traits::construct(allocator_, array_ + i, value);
4343
}
4444
}
4545
array(const array& other):
4646
allocator_(other.allocator_),
4747
size_(other.size_),
48-
array_(size_ == 0 ? nullptr : allocator_.allocate(size_))
48+
array_(allocator_.allocate(size_))
4949
{
5050
for (uint8_t i = 0; i < size_; ++i) {
5151
alloc_traits::construct(allocator_, array_ + i, other.array_[i]);

0 commit comments

Comments
 (0)