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

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 21:11:51 PST 2020


JDevlieghere marked 2 inline comments as done.
JDevlieghere added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallString.h:279
+  explicit operator std::string() const {
+    return std::string(this->begin(), this->size());
+  }
----------------
craig.topper wrote:
> 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.
Thanks Craig! I've fixed it for the `std::string` and `llvm::StringRef` case above.

```
To github.com:llvm/llvm-project.git
   cfebd777422..a5f479473b2  master -> master
```


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