Boost logo

Boost :

Subject: Re: [boost] [log] Status (was: Is there any interest in a Group of library like to Application System!)
From: Arash Partow (arash_at_[hidden])
Date: 2012-01-06 05:40:34


Andrey Semashev wrote:
> 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.
>

It's not dangerous. The way I would do it is provide a macro for logging that appends a suffix to the passed string - perhaps "boost_logxx" etc, the operator itself can be in the boost::log namespace.


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