From 6acbc242453a005690b40c6d300ac0813b293c7e Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Sat, 3 Aug 2024 17:44:58 -0400 Subject: [PATCH] streamable meta --- CMakeLists.txt | 2 +- include/blt/std/meta.h | 25 +++++++++++++++++++++++++ libraries/parallel-hashmap | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f53061..9b32288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.18.16) +set(BLT_VERSION 0.18.17) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/std/meta.h b/include/blt/std/meta.h index cf2904e..828819c 100644 --- a/include/blt/std/meta.h +++ b/include/blt/std/meta.h @@ -21,6 +21,8 @@ #include #include +#include +#include namespace blt::meta { @@ -56,6 +58,29 @@ namespace blt::meta template lambda_helper(Lambda) -> lambda_helper; + // https://stackoverflow.com/questions/66397071/is-it-possible-to-check-if-overloaded-operator-for-type-or-class-exists + template + class is_streamable + { + private: + template + static auto test(int) -> decltype(std::declval() << std::declval(), std::true_type()) + { + return std::declval(); + } + + template + static auto test(...) -> std::false_type + { + return std::declval(); + } + + public: + static constexpr bool value = decltype(test(0))::value; + }; + + template + inline constexpr bool is_streamable_v = is_streamable::value; } diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 8a889d3..d88c5e1 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6 +Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b