As I discovered from this post the parameter types allowed for a user-defined literal type are as follows:
const char*
unsigned long long int
long double
char
wchar_t
char16_t
char32_t
const char*, std::size_t
const wchar_t*, std::size_t
const char16_t*, std::size_t
const char32_t*, std::size_t
Well, the only signed integer I see in that list is char
, which is too small. What if I wanted to do something like this:
str operator"" _i(int i) {
return i*2;
}
Then when I write -1000_i
I expect to get -2000
. How do I do this?