Skip to content

Commit ad44d01

Browse files
committed
Small refactor of VSG_type_name macro to make it possible to depracate EVSG_type_name macro.
1 parent 3beb56e commit ad44d01

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

include/vsg/core/type_name.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ namespace vsg
3838
template<> constexpr const char* type_name<float>() noexcept { return "float"; }
3939
template<> constexpr const char* type_name<double>() noexcept { return "double"; }
4040

41-
// helper define for defining the type_name() for a type within the vsg namespace.
41+
/// Helper macro for defining the type_name() for a type, if used within vsg namespace you can put in alongside the class.
42+
/// If adding type name for a class in another namespace you must put the macro in the global scope rather than within the namespace, otherwise you'll get a namespace related compile error.
4243
#define VSG_type_name(T) \
43-
template<> constexpr const char* type_name<T>() noexcept { return #T; } \
44-
template<> constexpr const char* type_name<const T>() noexcept { return "const "#T; }
45-
46-
47-
// helper define for defining the type_name() for a type in a namespace other than vsg, note must be placed in global namespace.
48-
#define EVSG_type_name(T) \
4944
template<> constexpr const char* vsg::type_name<T>() noexcept { return #T; } \
5045
template<> constexpr const char* vsg::type_name<const T>() noexcept { return "const "#T; }
5146

47+
/// deprecated, it's now possible to use the VSG_type_name() directly.
48+
#define EVSG_type_name(T) VSG_type_name(T)
49+
5250
// clang-format on
5351

5452
} // namespace vsg

0 commit comments

Comments
 (0)