OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
danakj
2015/11/13 19:54:02
Can you move these to base/stl_util.h?
vmpstr
2015/11/13 23:15:38
I was under the impression that code should live c
danakj
2015/11/13 23:41:06
Crashpad will define new things in its own compat
vmpstr
2015/11/13 23:50:49
Ah OK. That makes sense.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_BASE_CONTAINER_UTIL_H_ | |
6 #define CC_BASE_CONTAINER_UTIL_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 | |
10 namespace cc { | |
11 | |
12 template <typename Container> | |
danakj
2015/11/13 19:54:02
please leave comments on these explaining what the
vmpstr
2015/11/13 23:15:38
Done.
| |
13 typename Container::value_type TakeFront(Container* container) { | |
14 typename Container::value_type element = std::move(container->front()); | |
vmpstr
2015/11/12 08:56:01
Note that this is using std::move, to allow for no
danakj
2015/11/13 19:54:02
Ya, you should use .Pass() and a TODO if you want
vmpstr
2015/11/13 23:15:38
Done.
| |
15 container->pop_front(); | |
16 return element; | |
17 } | |
18 | |
19 template <typename Container> | |
20 typename Container::value_type TakeBack(Container* container) { | |
21 typename Container::value_type element = std::move(container->back()); | |
22 container->pop_back(); | |
23 return element; | |
24 } | |
25 | |
26 } // namespace cc | |
27 | |
28 #endif // CC_BASE_CONTAINER_UTIL_H_ | |
OLD | NEW |