From a606fedf07f3f81f184c0dacc973eaa09f13ac2e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 10 Mar 2021 13:33:14 +0800 Subject: [PATCH] include/byteorder: add constructor for ceph_le so we can construct a ceph_le<> instance without using the init_le*() helpers. this would improve the readability a little bit. Signed-off-by: Kefu Chai --- src/include/byteorder.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/byteorder.h b/src/include/byteorder.h index f934145cb7b..189898121fd 100644 --- a/src/include/byteorder.h +++ b/src/include/byteorder.h @@ -16,6 +16,10 @@ struct ceph_le { private: T v; public: + ceph_le() = default; + explicit ceph_le(T nv) + : v{boost::endian::native_to_little(nv)} + {} ceph_le& operator=(T nv) { v = boost::endian::native_to_little(nv); return *this; -- 2.47.3