Boost logo

Boost :

Subject: Re: [boost] [Hana] Migrating sqlpp11 to Hana (hypothetically)
From: Roland Bock (rbock_at_[hidden])
Date: 2015-06-17 04:29:45


On 2015-06-17 08:39, Jeremy Maitin-Shepard wrote:
> Louis Dionne <ldionne.2 <at> gmail.com> writes:
>> Roland Bock <rbock <at> eudoxos.de> writes:
>>> On 2015-06-15 21:08, Louis Dionne wrote:
>>>> Is it acceptable to only import the `_s` string literal from Hana?
>>>>
>>>> using boost::hana::literals::operator""_s;
>>> Not really. This code has to be provided by the user of the library. It
>>> lives outside the sqlpp namespace. I cannot just tell them, to please
>>> import some string literal into their namespace.
>>>
>>> [...]
>> I must admit I don't have a solution. This is such a pain since it is a
>> __joke__ in terms of implementation difficulty at the compiler/language
>> level, but I think it is not solvable at the library level.
> It seems there is the obvious solution of also defining operator""
> _boost_hana_s in the global namespace. I guess it is just a question of how
> common this problem is likely to be.
Sure, but doesn't that feel like we're back in the dark ages before
namespaces?

There was a nice suggestion from Tomasz on the std-proposals list [1]:

<quote>
[...] However I think that better syntax would be to place the
qualification before literal itself, so we would get:

auto hello = "hello"s;
auto world = std::"world"s;
auto any = std::literals::string_literals::"any"s; //If you insist on
writing more
and
auto s = boost::hana::"sample"_s;

Having prefixed qualified literal would allow to remove the limittion to
use _ in user defined literals, because situation would now be same as
for any other entity.
</quote>

Very cool suggestion :-)

Best,

Roland

[1]:
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/hAnVRTlsQZY/1iBWebLmr1cJ


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk