1 #ifndef cetlib_ostream_handle_h 2 #define cetlib_ostream_handle_h 43 :
osh_{std::make_unique<detail::ostream_observer>(os)}
48 std::ios_base::openmode
const mode = std::ios_base::out)
49 :
osh_{std::make_unique<detail::ostream_owner<std::ofstream>>(
50 std::ofstream(fn, mode))}
56 typename = std::enable_if_t<std::is_base_of_v<std::ostream, OSTREAM>>>
58 :
osh_{std::make_unique<detail::ostream_owner<OSTREAM>>(
std::move(os))}
79 osh_->stream().flush();
81 explicit operator bool()
const {
return static_cast<bool>(
osh_->stream()); }
82 operator std::ostream&() {
return osh_->stream(); }
85 std::unique_ptr<detail::ostream_handle_base>
osh_;
ostream_handle select_stream(std::string const &filename, std::ostream &default_os)
std::unique_ptr< detail::ostream_handle_base > osh_
void msg(const char *fmt,...)
ostream_handle(OSTREAM &&os)
ostream_handle & operator<<(char const msg[])
ostream_handle(std::string const &fn, std::ios_base::openmode const mode=std::ios_base::out)
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
ostream_handle(std::ostream &os)