xo-alloc/xo-indentlog/include/xo/indentlog/print/printer.hpp
Roland Conybeare 341fcfd1c7 Add 'xo-indentlog/' from commit 'd43c4af0b4'
git-subtree-dir: xo-indentlog
git-subtree-mainline: 1c3f033933
git-subtree-split: d43c4af0b4
2025-05-10 17:00:33 -05:00

28 lines
548 B
C++

/* @file printer.hpp */
#pragma once
#include <utility>
namespace xo {
namespace print {
/* print an event to a logfile
* intended to be usable as EventSink argument
* to RealizationSimSource<T, EventSink>
*/
template<typename T, typename Stream>
class printer {
public:
printer(Stream && os) : os_{std::move(os)} {}
void operator()(T const & x) {
this->os_ << x;
}
private:
Stream os_;
}; /*printer*/
} /*namespace print*/
} /*namespace xo*/
/* end printer.hpp */