OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ |
7 | 7 |
8 #include "mojo/public/cpp/bindings/map.h" | 8 #include "mojo/public/cpp/bindings/map.h" |
9 #include "mojo/public/cpp/bindings/map_traits.h" | 9 #include "mojo/public/cpp/bindings/map_traits.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 static void AdvanceIterator(ConstIterator& iterator) { iterator++; } | 30 static void AdvanceIterator(ConstIterator& iterator) { iterator++; } |
31 static void AdvanceIterator(Iterator& iterator) { iterator++; } | 31 static void AdvanceIterator(Iterator& iterator) { iterator++; } |
32 | 32 |
33 static const K& GetKey(Iterator& iterator) { return iterator->first; } | 33 static const K& GetKey(Iterator& iterator) { return iterator->first; } |
34 static const K& GetKey(ConstIterator& iterator) { return iterator->first; } | 34 static const K& GetKey(ConstIterator& iterator) { return iterator->first; } |
35 | 35 |
36 static V& GetValue(Iterator& iterator) { return iterator->second; } | 36 static V& GetValue(Iterator& iterator) { return iterator->second; } |
37 static const V& GetValue(ConstIterator& iterator) { return iterator->second; } | 37 static const V& GetValue(ConstIterator& iterator) { return iterator->second; } |
38 | 38 |
39 static void Insert(Map<K, V>& input, const K& key, V&& value) { | 39 static bool Insert(Map<K, V>& input, const K& key, V&& value) { |
40 input.insert(key, std::forward<V>(value)); | 40 input.insert(key, std::forward<V>(value)); |
| 41 return true; |
41 } | 42 } |
42 static void Insert(Map<K, V>& input, const K& key, const V& value) { | 43 static bool Insert(Map<K, V>& input, const K& key, const V& value) { |
43 input.insert(key, value); | 44 input.insert(key, value); |
| 45 return true; |
44 } | 46 } |
45 | 47 |
46 static void SetToEmpty(Map<K, V>* output) { output->SetToEmpty(); } | 48 static void SetToEmpty(Map<K, V>* output) { output->SetToEmpty(); } |
47 }; | 49 }; |
48 | 50 |
49 } // namespace mojo | 51 } // namespace mojo |
50 | 52 |
51 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ | 53 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STANDARD_H_ |
OLD | NEW |