Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: null ptr to empty array
  • Loading branch information
proost committed Jan 27, 2026
commit 2c712e99ff17d8c6eff3c2c1dc53db5b10e0613d
4 changes: 2 additions & 2 deletions tuple/include/array_tuple_sketch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ class array {
using alloc_traits = std::allocator_traits<Allocator>;

explicit array(uint8_t size, const T& value, const Allocator& allocator = Allocator()):
allocator_(allocator), size_(size), array_(size_ == 0 ? nullptr : allocator_.allocate(size_)) {
allocator_(allocator), size_(size), array_(allocator_.allocate(size_)) {
for (uint8_t i = 0; i < size_; ++i) {
alloc_traits::construct(allocator_, array_ + i, value);
}
}
array(const array& other):
allocator_(other.allocator_),
size_(other.size_),
array_(size_ == 0 ? nullptr : allocator_.allocate(size_))
array_(allocator_.allocate(size_))
{
for (uint8_t i = 0; i < size_; ++i) {
alloc_traits::construct(allocator_, array_ + i, other.array_[i]);
Expand Down