From bc3cfd64790919461e0e22520fe32c2989476295 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Thu, 9 Jul 2020 20:55:14 -0400 Subject: [PATCH] add support for stl detect idiom over in-house impl closes #73 --- include/jwt-cpp/jwt.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h index 9f1b05a..55cc02a 100644 --- a/include/jwt-cpp/jwt.h +++ b/include/jwt-cpp/jwt.h @@ -23,10 +23,12 @@ #include #include #include - -#ifdef __cpp_lib_void_t -// We have std::void_t and std::make_void #include + +#ifdef __has_include +#if __has_include() +#include +#endif #endif //If openssl version less than 1.1 @@ -826,8 +828,6 @@ namespace jwt { } // namespace json namespace details { - namespace impl { - #ifdef __cpp_lib_void_t template using void_t = std::void_t; @@ -842,6 +842,14 @@ namespace jwt { template using void_t = typename make_void::type; #endif + +#ifdef __cpp_lib_experimental_detect + template class _Op, typename... _Args> + using is_detected = std::experimental::is_detected<_Op, _Args...>; + + template class _Op, typename... _Args> + using is_detected_t = std::experimental::detected_t<_Op, _Args...>; +#else struct nonesuch { nonesuch() = delete; @@ -866,13 +874,13 @@ namespace jwt { using value = std::true_type; using type = Op; }; - } // namespace impl template