Boost logo

Boost :

Subject: Re: [boost] [log] Status (was: Is there any interest in a Group of library like to Application System!)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-01-05 06:16:27


On Thursday, January 05, 2012 20:35:43 Arash Partow wrote:
>
> As for c++11 udsl, basically one can define a suffix for a particular type
> of string, and a corresponding handler operator, which takes a pointer to
> the literal and a size (length) value - which is determined at
> compile-time, hence no need for internal calls to strnlen (multipasses) or
> inefficient loops of pushing 1 char at-a-time to a stream(file, stdout
> etc..). [section 3.4]
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2378.pdf

After reading the standard and a few code samples on the net, this looks like
an interesting but somewhat dangerous feature. There seem to be no way to
specify a namespace for the literal operator, so name clashes are most
possible. I could introduce a suffix operator to automatically convert a
string literal to a basic_string_literal object, but would that be
significantly better than traditional generator functions?

  string_literal s1 = "abcd"s;

vs

  string_literal s2 = str_literal("abcd");

Note that in the latter case I can specify namespace for the str_literal
function while in the former case it's not possible.


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