xo-alloc/xo-refcnt/include/xo/refcnt/Displayable.hpp
Roland Conybeare 2075b654af Add 'xo-refcnt/' from commit 'bcd86e5324'
git-subtree-dir: xo-refcnt
git-subtree-mainline: ce2fc80bfd
git-subtree-split: bcd86e5324
2025-05-10 18:31:14 -05:00

29 lines
750 B
C++

/* @file Displayable.hpp */
#pragma once
#include "Refcounted.hpp"
namespace xo {
namespace ref {
class Displayable : public Refcount {
public:
/* write some kind of human-readable representation on stream */
virtual void display(std::ostream & os) const = 0;
std::string display_string() const;
}; /*Displayable*/
/* see also
* operator<<(std::ostream &, intrusive_ptr<T> const &)
* in [Refcounted.hpp]
*/
inline std::ostream &
operator<<(std::ostream &os, Displayable const & x) {
x.display(os);
return os;
} /*operator<<*/
} /*namespace ref*/
} /*namespace xo*/
/* end Displayable.hpp */