pytorch
582485bf - [BE] Use data() method when possible as it's safer and more readable (#92755)

Commit
1 year ago
[BE] Use data() method when possible as it's safer and more readable (#92755) Apply clang-tidy readability-data-pointer fixits. This essentially uses the data() method when possible instead of the less readable `&vec[0]` to get the address of the underlying backing implementation. Not only is this more readable, it is safer as it allows you to retrieve the pointer even when the std::vector or std::string is empty without throwing an index error. Pull Request resolved: https://github.com/pytorch/pytorch/pull/92755 Approved by: https://github.com/ezyang
Author
Committer
Parents
Loading