Skip to content

Commit

Permalink
[skip ci] attempt at is_basic_claim check
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc committed May 26, 2020
1 parent 146e677 commit bcd7e3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,17 @@ namespace jwt {
value_type, object_type, array_type, string_type, \
boolean_type, integer_type, number_type, traits

namespace details {
template <template <typename...> class, template<typename...> class>
struct is_same_template : std::false_type{};

template <template <typename...> class T>
struct is_same_template<T,T> : std::true_type{};

template<template <typename...> class basic_claim_type>
using is_basic_claim = is_same_template<basic_claim_type, basic_claim>;
}

/**
* Base class that represents a token payload.
* Contains Convenience accessors for common claims.
Expand Down
2 changes: 2 additions & 0 deletions tests/NlohmannTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ TEST(NholmannTest, BasicClaims) {
using nholmann_claim =
jwt::basic_claim<JWT_NHOLMANN_CLAIM_TPL>;

static_assert(jwt::details::is_basic_claim<nholmann_claim>::value, "must be basic claim");

const auto string = nholmann_claim(std::string("string"));
const auto array = nholmann_claim(std::set<std::string>{"string", "string"});
const auto integer = nholmann_claim(159816816);
Expand Down

0 comments on commit bcd7e3f

Please sign in to comment.