There are some literal operators in the std::literals
namespace with their corresponding header such as operator""s
, operator""sv
etc.
I wonder why those operators are not automatically export when including the corresponding header since they cannot conflict with each other or user-defined literals operators which must begin with the underscore and usually users like me want to use them when including the header.
It would be nice that the using std::string_literals::operator""s;
already in the <string>
header as well as other libraries:
#include <string> // automatically export the literal operators
#include <chrono> // automatically export the literal operators
int main() {
auto str = "hello world"s;
auto sec = 10s;
}
I can't see any harm with it. Why does Committee not like this? Is there some issue with it or this is a bad practice?