Displaying 4 results from an estimated 4 matches for "thetwin".
Did you mean:
thetwine
2011 Jul 24
0
[LLVMdev] Correct use of StringRef and Twine
...e issue.
So here are my ideas:
1) the easy solution: create a StringRef subclass (or new type with a
similarly expressive API) that wraps a buffer that it may or may not
use. Give it a ctor that takes a Twine. The use case then goes from
this:
SmallVectorImpl<char> v;
StringRef s = theTwine.GetStringRef(v);
to this:
TwineString s(theTwine);
(& the ctor looks like: TwineString(const Twine& t) { *this =
t.GetStringRef(this->buffer); })
So any Twine sink now has to pay one line of code to get a usable
string out of a Twine. Cheap to implement, easy to fix existing use...
2011 Jul 24
2
[LLVMdev] Correct use of StringRef and Twine
...> 1) the easy solution: create a StringRef subclass (or new type with a
> similarly expressive API) that wraps a buffer that it may or may not
> use. Give it a ctor that takes a Twine. The use case then goes from
> this:
>
> SmallVectorImpl<char> v;
> StringRef s = theTwine.GetStringRef(v);
>
> to this:
>
> TwineString s(theTwine);
>
> (& the ctor looks like: TwineString(const Twine& t) { *this =
> t.GetStringRef(this->buffer); })
> So any Twine sink now has to pay one line of code to get a usable
> string out of a Twine. C...
2011 Jul 23
2
[LLVMdev] Correct use of StringRef and Twine
On Jul 22, 2011, at 2:59 PM, David Blaikie wrote:
>> The dangerous part of this is that characters are integers, so "foo" + 'x' is very likely to cause serious problems.
>
> std::string already provides such overloads though, doesn't it? So the
> code isn't any safer from accidental "foo" + 'x' expressions that
> don't include
2011 Jul 25
0
[LLVMdev] Correct use of StringRef and Twine
...on: create a StringRef subclass (or new type with a
>> similarly expressive API) that wraps a buffer that it may or may not
>> use. Give it a ctor that takes a Twine. The use case then goes from
>> this:
>>
>> SmallVectorImpl<char> v;
>> StringRef s = theTwine.GetStringRef(v);
>>
>> to this:
>>
>> TwineString s(theTwine);
>>
>> (& the ctor looks like: TwineString(const Twine& t) { *this =
>> t.GetStringRef(this->buffer); })
>> So any Twine sink now has to pay one line of code to get a usable...