[all-commits] [llvm/llvm-project] d5acc8: Implement LWG#1203 for raw_ostream.

Christian Sigg via All-commits all-commits at lists.llvm.org
Mon Dec 9 14:01:26 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d5acc83a3ac3db85ca30b9e73b1bdb112f313d1b
      https://github.com/llvm/llvm-project/commit/d5acc83a3ac3db85ca30b9e73b1bdb112f313d1b
  Author: Christian Sigg <csigg at google.com>
  Date:   2019-12-09 (Mon, 09 Dec 2019)

  Changed paths:
    M llvm/include/llvm/Support/raw_ostream.h
    M llvm/unittests/Support/raw_ostream_test.cpp

  Log Message:
  -----------
  Implement LWG#1203 for raw_ostream.

Implement LWG#1203 (https://cplusplus.github.io/LWG/issue1203) for raw_ostream
like libc++ does for std::basic_ostream<...>.

Add a operator<< overload that takes an rvalue reference of a typed derived from
raw_ostream, streams the value to it and returns the stream of the same type as
the argument.

This allows free operator<< to work with rvalue reference raw_ostreams:
raw_ostream& operator<<(raw_ostream&, const SomeType& Value);
raw_os_ostream(std::cout) << SomeType();

It also allows using the derived type like:
auto Foo = (raw_string_ostream(buffer) << "foo").str();

Author: Christian Sigg <csigg at google.com>
Differential Revision: https://reviews.llvm.org/D70686




More information about the All-commits mailing list