
On Thursday, January 05, 2012 20:35:43 Arash Partow wrote:
On 5/01/2012 7:08 PM, Andrey Semashev wrote:
On Thursday, January 05, 2012 18:49:46 Arash Partow wrote:
Out of curiosity, have you considered at some point adding support for the new C++11 user-defined literals? I believe there would be a huge efficiency advantage in having the length of the literal at compile time, rather than having to determine it at run-time.
There is a tool named basic_string_literal that does it in C++03. Is there something new in C++11 that helps in this area? Could you provide a link to the proposal or a particular section in the standard?
Is basic_string_literal in the log library? I'll have to look at that,
Yes, see boost/log/utility/string_literal.hpp.
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
Interesting, I wasn't aware of this extension. Thanks for the pointer. I'll have to think if and how it can be applied to the library.