79365305

Date: 2025-01-17 15:47:12
Score: 1.5
Natty:
Report link

I know the topic is quite old but there are surprisingly few solutions on the Net (none actually satisfying).

First of all, since C++ doesn't allow yet templated user defined literals (not really), if you want to eliminate duplicates you will need preprocessor macros.

In our projects we've been using this https://gist.github.com/hatelamers/79097cc5b7424400f528c7661d14249f for years - it eliminates double literals entirely and generates no additional code in production (only actually used constants remain).

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: doudou