Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UDL's in the C++0x library

7 views
Skip to first unread message

Sean Hunt

unread,
Nov 18, 2009, 1:32:06 PM11/18/09
to
Currently, the draft C++0x library has no user-defined literals. It
seems wasteful to include them as a language feature but not include
the ability to use them for standard types. There are only two types I
really feel need UDLs - complex<T> (a suffix 'i' for imaginary values)
and basic_string (a suffix 's'), and defining UDLs for them would be 7
functions that would occupy a reserved name space (sic).

I think that these literals would be a useful addition to the library,
and ought to be considered for C++0x for the ease of use they provide.
If there are any reasons they should not be standardized, they likely
indicate flaws in the UDL proposal that should be resolved before a
committee-designed feature is shipped.

Sean Hunt

--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std...@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

Greg Herlihy

unread,
Nov 19, 2009, 2:59:50 PM11/19/09
to
On Nov 18, 1:32 pm, Sean Hunt <ride...@gmail.com> wrote:
> Currently, the draft C++0x library has no user-defined literals. It
> seems wasteful to include them as a language feature but not include
> the ability to use them for standard types. There are only two types I
> really feel need UDLs - complex<T> (a suffix 'i' for imaginary values)
> and basic_string (a suffix 's'), and defining UDLs for them would be 7
> functions that would occupy a reserved name space (sic).

As far as I can tell, the functions needed to create UDLs for Standard
Library types could be defined in the global namespace - or, in any
namespace that would be searched when resolving an unqualified name.

Greg

Sean Hunt

unread,
Nov 20, 2009, 4:36:16 PM11/20/09
to
On Nov 19, 12:59 pm, Greg Herlihy <gre...@mac.com> wrote:
> As far as I can tell, the functions needed to create UDLs for Standard
> Library types could be defined in the global namespace - or, in any
> namespace that would be searched when resolving an unqualified name.
>
> Greg

They could, however, all UDL names not starting with an underscore are
"reserved for future standardization", whatever that means.

Sean

0 new messages