Remove unnecessary string copies (#891)

1. Use string_view instead of string when there is no need for copy.
2. Otherwise move string when possible.
This commit is contained in:
Cheng
2024-03-29 05:14:59 +09:00
committed by GitHub
parent 45f636e759
commit 46caf0bef0
11 changed files with 36 additions and 41 deletions

View File

@@ -60,10 +60,10 @@ struct buffer_info {
std::vector<ssize_t> strides;
buffer_info(
const std::string& format,
std::string format,
std::vector<ssize_t> shape_in,
std::vector<ssize_t> strides_in)
: format(format),
: format(std::move(format)),
shape(std::move(shape_in)),
strides(std::move(strides_in)) {}