How to write a literal constant like “size_t s = 16 MByte”?

In modern C++ you should define a literal notation, e.g.

auto operator""_MB( unsigned long long const x )
    -> long
{ return 1024L*1024L*x; }

Then write

long const poolSize = 16_MB;

Don’t use macros, they’re Evilâ„¢. In so many ways.


Disclaimer: code not touched by compiler’s hands.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)