소스 검색

refactor: missed enumerate

Sam Jaffe 1 년 전
부모
커밋
8334b24289
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  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();