]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: add reference to the iterator of segment_map_t
authorXinyu Huang <xinyu.huang@intel.com>
Fri, 18 Nov 2022 02:39:29 +0000 (02:39 +0000)
committerXinyu Huang <xinyu.huang@intel.com>
Tue, 22 Nov 2022 09:31:13 +0000 (09:31 +0000)
Signed-off-by: Xinyu Huang <xinyu.huang@intel.com>
src/crimson/os/seastore/seastore_types.h

index 72b75f19a568ddf9ecff6a472f12866774203e4d..8698a3af1d8e8fc8cb7a801f2d1bbf522ee86e59 100644 (file)
@@ -391,13 +391,11 @@ private:
       assert(!is_end());
       return &*current;
     }
-    template <bool c = is_const, std::enable_if_t<c, int> = 0>
-    const std::pair<const segment_id_t, const T&> &operator*() {
-      assert(!is_end());
-      return *current;
-    }
-    template <bool c = is_const, std::enable_if_t<!c, int> = 0>
-    std::pair<const segment_id_t, T&> &operator*() {
+
+    using reference = std::conditional_t<
+      is_const, const std::pair<const segment_id_t, const T&>&,
+      std::pair<const segment_id_t, T&>&>;
+    reference operator*() {
       assert(!is_end());
       return *current;
     }