]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: provide a template for object dumps
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 16 Jan 2024 18:59:47 +0000 (13:59 -0500)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 22 Mar 2024 15:38:01 +0000 (11:38 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 92df0fcc649345f438d0d7cc6fab658c02060f07)

src/common/dout.h

index 4cd60efff8fef18f01a4be7352b5c4393b444496..8e27a0b1b433941cf80274b21e8b4d696ebfdff7 100644 (file)
@@ -44,6 +44,18 @@ inline std::ostream& operator<<(std::ostream& out, _bad_endl_use_dendl_t) {
   return out;
 }
 
+template<typename T>
+concept HasPrint = requires(T t, std::ostream& u) {
+  { t.print(u) } -> std::same_as<void>;
+};
+
+template<typename T> requires HasPrint<T>
+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;