Allow SmallString to implicitly convert to StringRef.

llvm-svn: 89529
This commit is contained in:
Daniel Dunbar 2009-11-21 02:01:24 +00:00
parent 9d6daf2cc4
commit dbeef0c161
1 changed files with 4 additions and 1 deletions

View File

@ -38,12 +38,15 @@ public:
// Extra methods.
StringRef str() const { return StringRef(this->begin(), this->size()); }
// Implicit conversion to StringRef.
operator StringRef() const { return str(); }
const char *c_str() {
this->push_back(0);
this->pop_back();
return this->data();
}
// Extra operators.
const SmallString &operator=(StringRef RHS) {
this->clear();