Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce UNIT_NO_LITERAL_SUPPORT directive #316

Merged
merged 3 commits into from
Dec 16, 2024
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
7 changes: 5 additions & 2 deletions include/units/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ namespace units
* are placed in the `units::literals` namespace.
* @param namePlural - plural version of the unit name, e.g. 'meters'
* @param abbreviation - abbreviated unit name, e.g. 'm'
* @note When UNIT_HAS_LITERAL_SUPPORT is not defined, the macro does not generate any code
* @note When UNIT_NO_LITERAL_SUPPORT is not defined, the macro does not generate any code
*/
#ifdef UNIT_NO_LITERAL_SUPPORT
#define UNIT_ADD_LITERALS(namespaceName, namePlural, abbreviation)
#else
#define UNIT_ADD_LITERALS(namespaceName, namePlural, abbreviation) \
namespace literals \
{ \
Expand All @@ -246,7 +249,7 @@ namespace units
return namespaceName::namePlural<int>(static_cast<int>(d)); \
} \
}

#endif
/**
* @def UNIT_ADD(namespaceName, namePlural, abbreviation, definition)
* @brief Macro for generating the boiler-plate code needed for a new unit.
Expand Down