From: Daniel Dunbar Date: Sat, 21 Nov 2009 02:01:24 +0000 (+0000) Subject: Allow SmallString to implicitly convert to StringRef. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=983c7fe847dd3f46945f0117ab19345b9c68e88f;p=oota-llvm.git Allow SmallString to implicitly convert to StringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89529 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h index 035462515a8..05bd8a42c67 100644 --- a/include/llvm/ADT/SmallString.h +++ b/include/llvm/ADT/SmallString.h @@ -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();