Merge "Add noexcept to move constructors and assignment operators."
This commit is contained in:
@@ -47,11 +47,11 @@ class unique_cptr {
|
||||
constexpr unique_cptr() : ptr_(nullptr) {}
|
||||
constexpr unique_cptr(std::nullptr_t) : ptr_(nullptr) {}
|
||||
explicit unique_cptr(pointer ptr) : ptr_(ptr) {}
|
||||
unique_cptr(unique_cptr&& o) : ptr_(o.ptr_) { o.ptr_ = nullptr; }
|
||||
unique_cptr(unique_cptr&& o) noexcept : ptr_(o.ptr_) { o.ptr_ = nullptr; }
|
||||
|
||||
~unique_cptr() { std::free(reinterpret_cast<void*>(ptr_)); }
|
||||
|
||||
inline unique_cptr& operator=(unique_cptr&& o) {
|
||||
inline unique_cptr& operator=(unique_cptr&& o) noexcept {
|
||||
if (&o == this) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ struct ConfigDescription : public android::ResTable_config {
|
||||
ConfigDescription();
|
||||
ConfigDescription(const android::ResTable_config& o); // NOLINT(implicit)
|
||||
ConfigDescription(const ConfigDescription& o);
|
||||
ConfigDescription(ConfigDescription&& o);
|
||||
ConfigDescription(ConfigDescription&& o) noexcept;
|
||||
|
||||
ConfigDescription& operator=(const android::ResTable_config& o);
|
||||
ConfigDescription& operator=(const ConfigDescription& o);
|
||||
ConfigDescription& operator=(ConfigDescription&& o);
|
||||
ConfigDescription& operator=(ConfigDescription&& o) noexcept;
|
||||
|
||||
ConfigDescription CopyWithoutSdkVersion() const;
|
||||
|
||||
@@ -124,7 +124,7 @@ inline ConfigDescription::ConfigDescription(const ConfigDescription& o) {
|
||||
*static_cast<android::ResTable_config*>(this) = o;
|
||||
}
|
||||
|
||||
inline ConfigDescription::ConfigDescription(ConfigDescription&& o) {
|
||||
inline ConfigDescription::ConfigDescription(ConfigDescription&& o) noexcept {
|
||||
*this = o;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ inline ConfigDescription& ConfigDescription::operator=(
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline ConfigDescription& ConfigDescription::operator=(ConfigDescription&& o) {
|
||||
inline ConfigDescription& ConfigDescription::operator=(ConfigDescription&& o) noexcept {
|
||||
*this = o;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class BigBuffer {
|
||||
*/
|
||||
explicit BigBuffer(size_t block_size);
|
||||
|
||||
BigBuffer(BigBuffer&& rhs);
|
||||
BigBuffer(BigBuffer&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Number of occupied bytes in all the allocated blocks.
|
||||
@@ -136,7 +136,7 @@ class BigBuffer {
|
||||
inline BigBuffer::BigBuffer(size_t block_size)
|
||||
: block_size_(block_size), size_(0) {}
|
||||
|
||||
inline BigBuffer::BigBuffer(BigBuffer&& rhs)
|
||||
inline BigBuffer::BigBuffer(BigBuffer&& rhs) noexcept
|
||||
: block_size_(rhs.block_size_),
|
||||
size_(rhs.size_),
|
||||
blocks_(std::move(rhs.blocks_)) {}
|
||||
|
||||
@@ -32,8 +32,8 @@ class ImmutableMap {
|
||||
using const_iterator =
|
||||
typename std::vector<std::pair<TKey, TValue>>::const_iterator;
|
||||
|
||||
ImmutableMap(ImmutableMap&&) = default;
|
||||
ImmutableMap& operator=(ImmutableMap&&) = default;
|
||||
ImmutableMap(ImmutableMap&&) noexcept = default;
|
||||
ImmutableMap& operator=(ImmutableMap&&) noexcept = default;
|
||||
|
||||
static ImmutableMap<TKey, TValue> CreatePreSorted(
|
||||
std::initializer_list<std::pair<TKey, TValue>> list) {
|
||||
|
||||
@@ -46,7 +46,7 @@ class Maybe {
|
||||
template <typename U>
|
||||
Maybe(const Maybe<U>& rhs); // NOLINT(implicit)
|
||||
|
||||
Maybe(Maybe&& rhs);
|
||||
Maybe(Maybe&& rhs) noexcept;
|
||||
|
||||
template <typename U>
|
||||
Maybe(Maybe<U>&& rhs); // NOLINT(implicit)
|
||||
@@ -56,7 +56,7 @@ class Maybe {
|
||||
template <typename U>
|
||||
Maybe& operator=(const Maybe<U>& rhs);
|
||||
|
||||
Maybe& operator=(Maybe&& rhs);
|
||||
Maybe& operator=(Maybe&& rhs) noexcept;
|
||||
|
||||
template <typename U>
|
||||
Maybe& operator=(Maybe<U>&& rhs);
|
||||
@@ -134,7 +134,7 @@ Maybe<T>::Maybe(const Maybe<U>& rhs) : nothing_(rhs.nothing_) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Maybe<T>::Maybe(Maybe&& rhs) : nothing_(rhs.nothing_) {
|
||||
Maybe<T>::Maybe(Maybe&& rhs) noexcept : nothing_(rhs.nothing_) {
|
||||
if (!rhs.nothing_) {
|
||||
rhs.nothing_ = true;
|
||||
|
||||
@@ -192,7 +192,7 @@ Maybe<T>& Maybe<T>::copy(const Maybe<U>& rhs) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline Maybe<T>& Maybe<T>::operator=(Maybe&& rhs) {
|
||||
inline Maybe<T>& Maybe<T>::operator=(Maybe&& rhs) noexcept {
|
||||
// Delegate to the actual assignment.
|
||||
return move(std::forward<Maybe<T>>(rhs));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user