From 4327b34c841fd6d8fb6509757d5cab2717d35457 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 11 Aug 2024 13:33:40 -0400 Subject: [PATCH] check for func --- CMakeLists.txt | 2 +- include/blt/std/meta.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd8a335..f35ace0 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.27) +set(BLT_VERSION 0.18.28) 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 b21408c..f6a54b4 100644 --- a/include/blt/std/meta.h +++ b/include/blt/std/meta.h @@ -65,7 +65,7 @@ namespace blt::meta lambda_helper(Lambda) -> lambda_helper; // https://stackoverflow.com/questions/66397071/is-it-possible-to-check-if-overloaded-operator-for-type-or-class-exists - template + template class is_streamable { private: @@ -87,6 +87,16 @@ namespace blt::meta template inline constexpr bool is_streamable_v = is_streamable::value; + +#define BLT_META_MAKE_FUNCTION_CHECK(FUNC, ...)\ + template \ + class has_func_##FUNC : public std::false_type \ + {}; \ + template \ + class has_func_##FUNC().drop(,##__VA_ARGS__))>> : public std::true_type \ + {}; \ + template \ + inline constexpr bool has_func_##FUNC##_v = has_func_##FUNC::value; \ }