[PATCH] D78795: [Support] Add raw_ostream_iterator: ostream_iterator for raw_ostream.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 23:08:59 PDT 2020


dblaikie added inline comments.


================
Comment at: llvm/unittests/Support/raw_ostream_test.cpp:355-371
+template <class T, class InputIt>
+std::string iterator_str(InputIt First, InputIt Last) {
+  std::string S;
+  raw_string_ostream Str(S);
+  std::copy(First, Last, raw_ostream_iterator<T>(Str));
+  Str.flush();
+  return S;
----------------
If you could simplify the testing to not use another whole container type and standard algorithm, that'd probably be good, in my opinion.

It'd make the tests more explicit/obvious about the surface area they're testing. You could test the empty case, and writing a few elements to the output iterator.

(this I feel a bit more strongly about than the other two comments)


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

https://reviews.llvm.org/D78795





More information about the llvm-commits mailing list