nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
955 stars 135 forks source link

Day suffix '_d' conflicts with literal from `date.h` library #271

Open krofik opened 3 years ago

krofik commented 3 years ago

Through my project I use this date library and units for all other units I have. The using namespace units::literals; exposes all (?) suffixes into global namespace, and here we have the a conflict inside date::sys_days { 1920_y / jan / 20_d }.

Is there any way to disable literals for specific type? I imagine that as same mechanism as already existing with DISABLE_PREDEFINED_UNITS.

It might go like this:

#define DISABLE_TIME_LITERAL_UNITS
#include <units.h>
using namespace units::literals;
// all literals except units::time are available