| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ |
| 6 #define EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ |
| 7 | 7 |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return it_->second.get(); | 62 return it_->second.get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 typename Map::const_iterator it_; | 66 typename Map::const_iterator it_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 BaseSetOperators() { | 69 BaseSetOperators() { |
| 70 // Ensure |T| is convertible to us, so we can safely downcast when calling | 70 // Ensure |T| is convertible to us, so we can safely downcast when calling |
| 71 // methods that must exist in |T|. | 71 // methods that must exist in |T|. |
| 72 COMPILE_ASSERT((base::is_convertible<T*, BaseSetOperators<T>*>::value), | 72 static_assert((base::is_convertible<T*, BaseSetOperators<T>*>::value), |
| 73 U_ptr_must_implicitly_convert_to_T_ptr); | 73 "U ptr must implicitly convert to T ptr"); |
| 74 } | 74 } |
| 75 | 75 |
| 76 BaseSetOperators(const T& set) { | 76 BaseSetOperators(const T& set) { |
| 77 this->operator=(set); | 77 this->operator=(set); |
| 78 } | 78 } |
| 79 | 79 |
| 80 ~BaseSetOperators() {} | 80 ~BaseSetOperators() {} |
| 81 | 81 |
| 82 T& operator=(const T& rhs) { | 82 T& operator=(const T& rhs) { |
| 83 return Assign(rhs); | 83 return Assign(rhs); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 map_.clear(); | 279 map_.clear(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 private: | 282 private: |
| 283 Map map_; | 283 Map map_; |
| 284 }; | 284 }; |
| 285 | 285 |
| 286 } // namespace extensions | 286 } // namespace extensions |
| 287 | 287 |
| 288 #endif // EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ | 288 #endif // EXTENSIONS_COMMON_PERMISSIONS_BASE_SET_OPERATORS_H_ |
| OLD | NEW |