[C++-0x] User-defined literals.
Ed Smith-Rowland
3dw4rd@verizon.net
Sun Sep 19 09:11:00 GMT 2010
Greetings,
I am slowly working on user defined literals for C++-0x.
This is my first foray into the C++ front end and I'm stuck.
Anyway, I managed to parse things like
long double
operator"" _foo(long double x) { return 2.0L * x; }
The result is a normal function that I can either call like
operator "" _foo(1.2L);
or just
_foo(1.2L);
The problem is when I parse something like
u"string"w
I want to generate a call to something like
std::string operator"" w(const char16_t*, size_t);
i.e. I want to build a call:
w(u"string", 6);
I have a (not nearly ready for prime time) patch attached. My current
problem is in parser.c cp_parser_primary_expression after the string types.
Thanks for any help you can give,
Ed
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_udlit
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20100919/04bdac10/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: user_defined_literal.cpp
Type: text/x-c++src
Size: 2250 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20100919/04bdac10/attachment.bin>
More information about the Gcc
mailing list