Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1101)

Side by Side Diff: base/containers/flat_set.h

Issue 2723853002: Implementing erase/erase_if functions from library fundamentals ts: (Closed)
Patch Set: Review, round 1. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/containers/flat_set_unittest.cc » ('j') | base/stl_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_CONTAINERS_FLAT_SET_H_ 5 #ifndef BASE_CONTAINERS_FLAT_SET_H_
6 #define BASE_CONTAINERS_FLAT_SET_H_ 6 #define BASE_CONTAINERS_FLAT_SET_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <functional> 9 #include <functional>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/stl_util.h"
14
13 namespace base { 15 namespace base {
14 16
15 // Overview: 17 // Overview:
16 // This file implements flat_set container. It is an alternative to standard 18 // This file implements flat_set container. It is an alternative to standard
17 // sorted containers that stores it's elements in contiguous memory (current 19 // sorted containers that stores it's elements in contiguous memory (current
18 // version uses sorted std::vector). 20 // version uses sorted std::vector).
19 // Discussion that preceded introduction of this container can be found here: 21 // Discussion that preceded introduction of this container can be found here:
20 // https://groups.google.com/a/chromium.org/forum/#!searchin/chromium-dev/vector $20based/chromium-dev/4uQMma9vj9w/HaQ-WvMOAwAJ 22 // https://groups.google.com/a/chromium.org/forum/#!searchin/chromium-dev/vector $20based/chromium-dev/4uQMma9vj9w/HaQ-WvMOAwAJ
21 // 23 //
22 // Motivation: 24 // Motivation:
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 652 }
651 653
652 // ---------------------------------------------------------------------------- 654 // ----------------------------------------------------------------------------
653 // General operations. 655 // General operations.
654 656
655 template <class Key, class Compare> 657 template <class Key, class Compare>
656 void flat_set<Key, Compare>::swap(flat_set& other) { 658 void flat_set<Key, Compare>::swap(flat_set& other) {
657 std::swap(impl_, other.impl_); 659 std::swap(impl_, other.impl_);
658 } 660 }
659 661
662 // ----------------------------------------------------------------------------
663 // Free functions.
664
665 template <typename Key, typename Compare, typename Predicate>
danakj 2017/03/03 20:11:49 Please describe the complexity of this method, the
666 void STLEraseIf(base::flat_set<Key, Compare>& container, Predicate pred) {
667 STLEraseRemoveIf(container, pred);
668 }
669
660 } // namespace base 670 } // namespace base
661 671
662 #endif // BASE_CONTAINERS_FLAT_SET_H_ 672 #endif // BASE_CONTAINERS_FLAT_SET_H_
OLDNEW
« no previous file with comments | « no previous file | base/containers/flat_set_unittest.cc » ('j') | base/stl_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698