[PATCH] D73640: [SmallString] Add explicit conversion to std::string

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 17:54:27 PST 2020


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallString.h:279
+  explicit operator std::string() const {
+    return std::string(this->begin(), this->size());
+  }
----------------
I'm late here, but that should probably be this->data() instead of this->begin(). It does the same thing in this case, but begin() returns an "iterator" while data() returns a pointer. And the constructor that's being called is defined as taking a pointer and size.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73640/new/

https://reviews.llvm.org/D73640





More information about the llvm-commits mailing list