From 739b7cdb901a85c0501088441efa0927ab7997cc Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Sat, 30 May 2020 23:32:46 -0400 Subject: [PATCH] improver traits + consistent order for tpl params --- include/jwt-cpp/jwt.h | 198 ++++++++++++++++++++++++----------------- tests/NlohmannTest.cpp | 8 +- 2 files changed, 118 insertions(+), 88 deletions(-) diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h index 5d92ace..77e70e1 100644 --- a/include/jwt-cpp/jwt.h +++ b/include/jwt-cpp/jwt.h @@ -761,8 +761,11 @@ namespace jwt { } namespace json { + /** + * Generic JSON types used in JWTs + * This enum is to abstract the third party underlying types + */ enum class type { - null, boolean, integer, number, @@ -773,11 +776,16 @@ namespace jwt { } namespace details { - template struct make_void + // https://en.cppreference.com/w/cpp/types/void_t + template + struct make_void { using type = void; }; - template using void_t = typename make_void::type; + + template + using void_t = typename make_void::type; + struct nonesuch { nonesuch() = delete; @@ -788,10 +796,8 @@ namespace jwt { void operator=(nonesuch&&) = delete; }; - template class Op, - class... Args> + // https://en.cppreference.com/w/cpp/experimental/is_detected + template class Op, class... Args> struct detector { using value = std::false_type; @@ -808,113 +814,130 @@ namespace jwt { template