Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions include/vsg/core/type_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ namespace vsg
template<> constexpr const char* type_name<float>() noexcept { return "float"; }
template<> constexpr const char* type_name<double>() noexcept { return "double"; }

// helper define for defining the type_name() for a type within the vsg namespace.
/// Helper macro for defining the type_name() for a type, if used within vsg namespace you can put in alongside the class.
/// 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.
#define VSG_type_name(T) \
template<> constexpr const char* type_name<T>() noexcept { return #T; } \
template<> constexpr const char* type_name<const T>() noexcept { return "const "#T; }


// helper define for defining the type_name() for a type in a namespace other than vsg, note must be placed in global namespace.
#define EVSG_type_name(T) \
template<> constexpr const char* vsg::type_name<T>() noexcept { return #T; } \
template<> constexpr const char* vsg::type_name<const T>() noexcept { return "const "#T; }

/// deprecated, it's now possible to use the VSG_type_name() directly.
#define EVSG_type_name(T) VSG_type_name(T)

// clang-format on

} // namespace vsg
Loading