C++ Logo

std-proposals

Advanced search

Re: Automatic export literals operators into global scope when the header is included

From: Richard Hodges <hodges.r_at_[hidden]>
Date: Thu, 11 Mar 2021 17:20:51 +0100
On Thu, 11 Mar 2021 at 09:15, kang hewill via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> One of the approaches would be put using
> std::literals::xxx_literals::operator""xxx; directly in their headers
> content:
>

I normally use

using namespace std::literals;

Which covers strings and chrono types. There can be no clash with
user-defined string literals, since they must always begin with an
underscore (_).

So while many would consider it bad manners, it's not unreasonable to put
this statement in a header file.

Received on 2021-03-11 10:21:06