소스 검색

feat(list): impl. find()

greatbridf 2 년 전
부모
커밋
f1116ddf25
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      include/types/list.hpp

+ 6 - 1
include/types/list.hpp

@@ -168,7 +168,12 @@ public:
         allocator_traits<sentry_allocator_type>::deconstruct_and_deallocate(static_cast<sentry_node_type*>(tail));
     }
 
-    // TODO: find
+    iterator_type find(const value_type& v) noexcept
+    {
+        for (iterator_type iter = begin(); iter != end(); ++iter)
+            if (*iter == v)
+                return iter;
+    }
 
     // erase the node which iter points to
     void erase(const iterator_type& iter) noexcept