]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
neorados: Make neorados::Entry aggregate initializable
authorAdam Emerson <aemerson@redhat.com>
Fri, 18 Aug 2023 22:07:22 +0000 (18:07 -0400)
committerAdam Emerson <aemerson@redhat.com>
Thu, 14 Sep 2023 21:48:00 +0000 (17:48 -0400)
Now that C++20 has designated initializers, this is the least
confusing way to handle objects like this.

Also switch to using the spaceship operator, while we're at it.

Signed-off-by: Adam Emerson <aemerson@redhat.com>
src/include/neorados/RADOS_Decodable.hpp

index 5e3a0d36eabb58340fa0076a8ff64425622a4274..777a2525c8e04b25d51a12d43356afe4d740d41c 100644 (file)
@@ -35,34 +35,8 @@ struct Entry {
   std::string oid;
   std::string locator;
 
-  Entry() {}
-  Entry(std::string nspace, std::string oid, std::string locator) :
-    nspace(std::move(nspace)), oid(std::move(oid)), locator(locator) {}
+  friend auto operator <=>(const Entry&, const Entry&) = default;
 };
-inline bool operator ==(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) ==
-    std::tie(r.nspace, r.oid, r.locator);
-}
-inline bool operator !=(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) !=
-    std::tie(r.nspace, r.oid, r.locator);
-}
-inline bool operator <(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) <
-    std::tie(r.nspace, r.oid, r.locator);
-}
-inline bool operator <=(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) <=
-    std::tie(r.nspace, r.oid, r.locator);
-}
-inline bool operator >=(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) >=
-    std::tie(r.nspace, r.oid, r.locator);
-}
-inline bool operator >(const Entry& l, const Entry r) {
-  return std::tie(l.nspace, l.oid, l.locator) >
-    std::tie(r.nspace, r.oid, r.locator);
-}
 
 inline std::ostream& operator <<(std::ostream& out, const Entry& entry) {
   if (!entry.nspace.empty())