Boost logo

Boost :

Subject: [boost] Interest in UDL suffixes for built-in and some standard library types?
From: Peter Sommerlad (peter.sommerlad_at_[hidden])
Date: 2012-09-05 11:57:16


Dear boost members,

I am preparing a paper for the next C++ standardization meeting for providing user-defined-literals for some standard types.

b (and a variety of derivations lik bULL) for binary integer literals as in 101b
s for std::string as "hello, world!"s
s, h, min, etc. for std::chrono::duration literals such as 0xfh for 15 hours
i, r for creating std::complex literals

see http://wiki.hsr.ch/PeterSommerlad/wiki.cgi?LiteralsForBinaryStringComplexDuration
for the paper draft.

It also includes machinery to parse integers using the template version of a user-defined literal, because using
constexpr operator"" foo(unsigned long long bar);
overload loses the ability to treat the number bar as a compile-time constant, e.g., to use as template argument further on.

Some people told me, such a facility would be nice in its own way, to be used by other authors of UDL constexpr overloads.

I wonder if there is interest to provide standard conforming versions of my implementation (including the required _ prefix) for boost (which would require to clean up things a bit beforehand).

Such a boost.suffixes library would only work with C++11 capable compilers that actually implement UDL and constexpr in combination (for some uses the constexpr is not required). gcc4.7.1 is fine, for example, my version of clang didn't do constexpr yet (that might have changed).

Feedback, encouragement and thoughts are welcome.

TIA and Best Regards
Peter.

-- 
Prof. Peter Sommerlad
Institut für Software: Bessere Software - Einfach, Schneller!
HSR Hochschule für Technik Rapperswil
Oberseestr 10, Postfach 1475, CH-8640 Rapperswil
http://ifs.hsr.ch http://cute-test.com http://linticator.com http://includator.com
tel:+41 55 222 49 84 == mobile:+41 79 432 23 32
fax:+41 55 222 46 29 == mailto:peter.sommerlad_at_[hidden]

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