From b383fb0d1619ea857726d8b9a390ade9ecf7cd6f Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 24 Jan 2024 17:03:20 -0500 Subject: [PATCH 1/2] lambda vistor help --- include/blt/std/utility.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/blt/std/utility.h b/include/blt/std/utility.h index b007bb0..6990dbe 100644 --- a/include/blt/std/utility.h +++ b/include/blt/std/utility.h @@ -212,6 +212,12 @@ namespace blt //#define BLT_LAMBDA(type, var, code) [](const type& var) -> auto { return code; } //#define BLT_LAMBDA(var, code) [](var) -> auto { return code; } +/* + * std::visit(blt::lambda_visitor{ + * lambdas... + * }, data_variant); + */ + // TODO: WTF template struct lambda_visitor : TLambdas... { From 2ef516e66a8a72b7ddf119867617c13ef147a05e Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 24 Jan 2024 17:37:01 -0500 Subject: [PATCH 2/2] check against nullptr --- include/blt/std/allocator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/blt/std/allocator.h b/include/blt/std/allocator.h index 3b5bfa5..40181a0 100644 --- a/include/blt/std/allocator.h +++ b/include/blt/std/allocator.h @@ -210,6 +210,8 @@ namespace blt void deallocate(pointer p, size_t n) noexcept { + if (p == nullptr) + return; // for (size_t i = 0; i < n; i++) // p[i].~T(); for (auto*& blk : blocks)