From: Patrick Donnelly Date: Tue, 16 Jan 2024 18:59:47 +0000 (-0500) Subject: common: provide a template for object dumps X-Git-Tag: v20.0.0~2328^2~59 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92df0fcc649345f438d0d7cc6fab658c02060f07;p=ceph.git common: provide a template for object dumps Signed-off-by: Patrick Donnelly --- diff --git a/src/common/dout.h b/src/common/dout.h index 6516060c543..8d05b12fbe2 100644 --- a/src/common/dout.h +++ b/src/common/dout.h @@ -44,6 +44,18 @@ inline std::ostream& operator<<(std::ostream& out, _bad_endl_use_dendl_t) { return out; } +template +concept HasPrint = requires(T t, std::ostream& u) { + { t.print(u) } -> std::same_as; +}; + +template requires HasPrint +static inline std::ostream& operator<<(std::ostream& out, T&& t) +{ + t.print(out); + return out; +} + class DoutPrefixProvider { public: virtual std::ostream& gen_prefix(std::ostream& out) const = 0;