| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 : m_data(other.m_data) | 86 : m_data(other.m_data) |
| 87 { | 87 { |
| 88 } | 88 } |
| 89 | 89 |
| 90 template <typename C> | 90 template <typename C> |
| 91 WebVector(const C& other) | 91 WebVector(const C& other) |
| 92 : m_data(other.begin(), other.end()) | 92 : m_data(other.begin(), other.end()) |
| 93 { | 93 { |
| 94 } | 94 } |
| 95 | 95 |
| 96 WebVector(WebVector<T>&& other) |
| 97 { |
| 98 swap(other); |
| 99 } |
| 100 |
| 96 WebVector& operator=(const WebVector& other) | 101 WebVector& operator=(const WebVector& other) |
| 97 { | 102 { |
| 98 if (this != &other) | 103 if (this != &other) |
| 99 assign(other); | 104 assign(other); |
| 100 return *this; | 105 return *this; |
| 101 } | 106 } |
| 102 | 107 |
| 108 WebVector& operator=(WebVector&& other) |
| 109 { |
| 110 if (this != &other) |
| 111 swap(other); |
| 112 return *this; |
| 113 } |
| 114 |
| 103 template <typename C> | 115 template <typename C> |
| 104 WebVector<T>& operator=(const C& other) | 116 WebVector<T>& operator=(const C& other) |
| 105 { | 117 { |
| 106 if (this != reinterpret_cast<const WebVector<T>*>(&other)) | 118 if (this != reinterpret_cast<const WebVector<T>*>(&other)) |
| 107 assign(other); | 119 assign(other); |
| 108 return *this; | 120 return *this; |
| 109 } | 121 } |
| 110 | 122 |
| 111 template <typename C> | 123 template <typename C> |
| 112 void assign(const C& other) | 124 void assign(const C& other) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 m_data.swap(other.m_data); | 160 m_data.swap(other.m_data); |
| 149 } | 161 } |
| 150 | 162 |
| 151 private: | 163 private: |
| 152 std::vector<T> m_data; | 164 std::vector<T> m_data; |
| 153 }; | 165 }; |
| 154 | 166 |
| 155 } // namespace blink | 167 } // namespace blink |
| 156 | 168 |
| 157 #endif | 169 #endif |
| OLD | NEW |