This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implement N3642 - User-defined Literals for Standard Library Types


On 31 May 2013 15:15, Ed Smith-Rowland wrote:
> Greetings,
>
> This patch implements N3642 - User-defined literals for
> std::chrono::duration and std::basic_string
> and N3660 - User-defined literals for std::complex.

Great, thanks!

> User-defined literals were separated into two papers because of some
> controversy about noexcept for complex literals.
> If desired, I could split the patch into two bits for the two proposals.
> OTOH, I'm pretty sure complex literals will make it in.

I'm not so sure, and if they do they might use "if" as the suffix
rather than "i_f", so please split this patch so the non-complex parts
can go in.

I don't think you need to touch config/abi/pre/gnu.ver, al lthe new
functions are inline and not exported from the library, so you don't
need to version symbols that aren't in the library (in fact, you
*can't* version symbols that aren't in the library!)

It looks like the changes to existing headers could be simplified by
not closing and reopening the namespace, i.e. instead of:

 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
[...]
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace

+#if __cplusplus > 201103L
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+inline namespace literals {
+inline namespace string_literals {
[...]

Just put the new stuff inside the already open namespace, i.e.

 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 [...]
+#if __cplusplus > 201103L
+
+inline namespace literals {
+inline namespace string_literals {
[...]
+} }
+#endif
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]