//////////////////////////////////////////////////////////////////////
-template<class T> struct dynamic::TypeInfo {
- static char const name[];
- static Type const type;
-};
-
-#define FB_DEC_TYPE(T) \
- template<> char const dynamic::TypeInfo<T>::name[]; \
- template<> dynamic::Type const dynamic::TypeInfo<T>::type
-
-FB_DEC_TYPE(void*);
-FB_DEC_TYPE(bool);
-FB_DEC_TYPE(fbstring);
-FB_DEC_TYPE(dynamic::Array);
-FB_DEC_TYPE(double);
-FB_DEC_TYPE(int64_t);
-FB_DEC_TYPE(dynamic::ObjectImpl);
-
-#undef FB_DEC_TYPE
+#define FOLLY_DYNAMIC_DEC_TYPEINFO(T, str, val) \
+ template <> struct dynamic::TypeInfo<T> { \
+ static constexpr const char* name = str; \
+ static constexpr dynamic::Type type = val; \
+ }; \
+ //
+
+FOLLY_DYNAMIC_DEC_TYPEINFO(void*, "null", dynamic::NULLT)
+FOLLY_DYNAMIC_DEC_TYPEINFO(bool, "boolean", dynamic::BOOL)
+FOLLY_DYNAMIC_DEC_TYPEINFO(fbstring, "string", dynamic::STRING)
+FOLLY_DYNAMIC_DEC_TYPEINFO(dynamic::Array, "array", dynamic::ARRAY)
+FOLLY_DYNAMIC_DEC_TYPEINFO(double, "double", dynamic::DOUBLE)
+FOLLY_DYNAMIC_DEC_TYPEINFO(int64_t, "int64", dynamic::INT64)
+FOLLY_DYNAMIC_DEC_TYPEINFO(dynamic::ObjectImpl, "object", dynamic::OBJECT)
+
+#undef FOLLY_DYNAMIC_DEC_TYPEINFO
template<class T>
T dynamic::asImpl() const {
//////////////////////////////////////////////////////////////////////
-#define DEF_TYPE(T, str, typen) \
- template<> char const dynamic::TypeInfo<T>::name[] = str; \
- template<> dynamic::Type const dynamic::TypeInfo<T>::type = typen
-
-DEF_TYPE(void*, "null", dynamic::NULLT);
-DEF_TYPE(bool, "boolean", dynamic::BOOL);
-DEF_TYPE(fbstring, "string", dynamic::STRING);
-DEF_TYPE(dynamic::Array, "array", dynamic::ARRAY);
-DEF_TYPE(double, "double", dynamic::DOUBLE);
-DEF_TYPE(int64_t, "int64", dynamic::INT64);
-DEF_TYPE(dynamic::ObjectImpl, "object", dynamic::OBJECT);
-
-#undef DEF_TYPE
+#define FOLLY_DYNAMIC_DEF_TYPEINFO(T) \
+ constexpr const char* dynamic::TypeInfo<T>::name; \
+ constexpr dynamic::Type dynamic::TypeInfo<T>::type; \
+ //
+
+FOLLY_DYNAMIC_DEF_TYPEINFO(void*)
+FOLLY_DYNAMIC_DEF_TYPEINFO(bool)
+FOLLY_DYNAMIC_DEF_TYPEINFO(fbstring)
+FOLLY_DYNAMIC_DEF_TYPEINFO(dynamic::Array)
+FOLLY_DYNAMIC_DEF_TYPEINFO(double)
+FOLLY_DYNAMIC_DEF_TYPEINFO(int64_t)
+FOLLY_DYNAMIC_DEF_TYPEINFO(dynamic::ObjectImpl)
+
+#undef FOLLY_DYNAMIC_DEF_TYPEINFO
const char* dynamic::typeName() const {
return typeName(type_);