From 8d3a088049b55bea0fc86ff01216600d1dca8e9c Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 21 Apr 2025 13:12:22 -0400 Subject: [PATCH] more types --- CMakeLists.txt | 2 +- include/blt/std/variant.h | 48 ++++++++++++++++++++++++++++++++++++++ libraries/parallel-hashmap | 2 +- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cac839c..6159065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 5.4.3) +set(BLT_VERSION 5.4.4) set(BLT_TARGET BLT) diff --git a/include/blt/std/variant.h b/include/blt/std/variant.h index 1b13a6f..e1428ef 100644 --- a/include/blt/std/variant.h +++ b/include/blt/std/variant.h @@ -58,6 +58,54 @@ namespace blt template using filter_void_t = typename filter_void::type; + template + struct member_func_meta + { + using can_invoke = std::is_invocable; + + using return_type = std::conditional_t, void>; + }; + + template + struct passthrough_value + { + using type = T; + using func = Func; + + bool has_value = false; + + explicit passthrough_value(const bool has_value): has_value(has_value) + { + } + + explicit operator bool() const + { + return has_value; + } + + }; + + template + struct first_invoke_member_func + { + constexpr static auto find_func() + { + return (... || []() + { + using Meta = member_func_meta; + if constexpr (Meta::can_invoke::value) + { + return passthrough_value{true}; + } + return passthrough_value{false}; + }()); + } + + using result = decltype(find_func()); + using return_type = typename result::type; + using func_type = typename result::func; + }; + template struct member_func_detail; diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 154c634..8a889d3 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 154c63489e84d5569d3b466342a2ae8fd99e4734 +Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6