Skip to content

Commit

Permalink
Use type traits for specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaileychess committed Aug 24, 2022
1 parent b7eb441 commit 7631145
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/idl_gen_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ struct ImportDefinition {

enum AnnotationType { kParam = 0, kType = 1, kReturns = 2 };

template<typename T> bool SupportsObjectAPI() { return false; }
template<typename T>
struct SupportsObjectAPI : std::false_type {};

// Structs can have Object API support.
template<> bool SupportsObjectAPI<StructDef>() { return true; }
template<>
struct SupportsObjectAPI<StructDef> : std::true_type {};

} // namespace

Expand Down

0 comments on commit 7631145

Please sign in to comment.