Browse Source

refactor: missed enumerate

Sam Jaffe 1 year ago
parent
commit
8334b24289
1 changed files with 1 additions and 3 deletions
  1. 1 3
      include/jvalidate/validation_visitor.h

+ 1 - 3
include/jvalidate/validation_visitor.h

@@ -333,12 +333,10 @@ public:
 
     if constexpr (std::totally_ordered<A>) {
       std::map<A, size_t> cache;
-      size_t index = 0;
-      for (A const & elem : document_.as_array()) {
+      for (auto const & [index, elem] : detail::enumerate(document_.as_array())) {
         if (auto [it, created] = cache.emplace(elem, index); not created) {
           return note(Status::Reject, "items ", it->second, " and ", index, " are equal");
         }
-        ++index;
       }
     } else {
       auto array = document_.as_array();