[llvm-dev] How does Twine work?

Russell Wallace via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 29 15:17:50 PDT 2019


I'm looking at the documentation on Twine at
http://llvm.org/docs/ProgrammersManual.html#llvm-adt-twine-h and it gives
example code:

void foo(const Twine &T);
...
StringRef X = ...
unsigned i = ...
foo(X + "." + Twine(i));

How exactly does that last line work? Since addition is left associative, I
would expect it to be parsed as (X + ".") ... so it's trying to add a
StringRef and a const char* before Twine can come into the picture at all?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190429/6d3f6c7c/attachment.html>


More information about the llvm-dev mailing list