#include <iostream>
namespace X {
inline namespace literals {
void operator ""_test(unsigned long long x) {
std::cout << x;
}
}
}
int main() {
{
using namespace X::literals;
10_test;
}
{
using X::operator""_test;
10_test;
}
}
_testlocated in Xand X::literals. This allows people using namespace X::literals;not to drag out everything from X, but within, is X _testalso available.
Importing a single literal is a little annoying.
std std::chrono, std::literals std::chrono::literals. inline namespace , , , , .