[libcxx-commits] [libcxx] Optimize input iterator overload of `std::vector::assign(first, last)` (PR #113852)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 26 13:59:19 PST 2024


================
@@ -116,6 +116,23 @@ inline std::vector<std::string> getRandomStringInputs(std::size_t N) {
   return inputs;
 }
 
+inline std::vector<std::string> getRandomStringInputsWithLength(std::size_t N, std::size_t len) { // N-by-len
+  std::vector<std::string> inputs;
+  inputs.reserve(N);
+  for (std::size_t i = 0; i < N; ++i)
+    inputs.push_back(getRandomString(len));
+  return inputs;
+}
+
+template <class IntT>
+inline std::vector<std::vector<IntT>> getRandomIntegerInputsWithLength(std::size_t N, std::size_t len) { // N-by-len
----------------
ldionne wrote:

```suggestion
std::vector<std::vector<IntT>> getRandomIntegerInputsWithLength(std::size_t N, std::size_t len) { // N-by-len
```

`inline` not needed since this is a template.

https://github.com/llvm/llvm-project/pull/113852


More information about the libcxx-commits mailing list