Skip to content

Commit d939e45

Browse files
authored
fix: Use of CachedEnforcer throws error from clang (#153)
- add <string> to casbin_types.h for visibility of std::hash<string> of CachedEnforcer's unordered_map - add default virtual destructor clang /include/c++/4.2.1 Apple clang version 12.0.5 (clang-1205.0.22.11) Target: x86_64-apple-darwin20.2.0 Signed-off-by: William Michaels <[email protected]>
1 parent 97b620e commit d939e45

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

casbin/enforcer_cached.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class CachedEnforcer : public Enforcer {
8484
*/
8585
CachedEnforcer(const std::string& model_path, const std::string& policy_file, bool enable_log);
8686

87+
virtual ~CachedEnforcer() = default;
88+
8789
bool Enforce(Scope scope);
8890

8991
// Enforce with a vector param,decides whether a "subject" can access a

include/casbin/casbin_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef CASBIN_CPP_CASBIN_TYPES_H
2020
#define CASBIN_CPP_CASBIN_TYPES_H
2121

22+
#include <string>
2223
#include <variant>
2324
#include <vector>
2425
#include <initializer_list>

0 commit comments

Comments
 (0)