From b2b972711de05ea559e86724c75dc2fd2f4af0ed Mon Sep 17 00:00:00 2001 From: Derek Bailey Date: Wed, 24 Aug 2022 12:16:44 -0700 Subject: [PATCH] Use type traits for specialization (#7475) --- src/idl_gen_ts.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp index 042bbba5575..f2d1b57f5a0 100644 --- a/src/idl_gen_ts.cpp +++ b/src/idl_gen_ts.cpp @@ -39,10 +39,11 @@ struct ImportDefinition { enum AnnotationType { kParam = 0, kType = 1, kReturns = 2 }; -template bool SupportsObjectAPI() { return false; } +template +struct SupportsObjectAPI : std::false_type {}; -// Structs can have Object API support. -template<> bool SupportsObjectAPI() { return true; } +template<> +struct SupportsObjectAPI : std::true_type {}; } // namespace @@ -756,7 +757,7 @@ class TsGenerator : public BaseGenerator { flat_file_import_declarations_[file][import_name] = name; if (parser_.opts.generate_object_based_api && - SupportsObjectAPI()) { + SupportsObjectAPI::value) { flat_file_import_declarations_[file][import_name + "T"] = object_name; } }