Commit d452f229 authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Various noexcept specifiers for swap methods

Summary: Pull Request resolved: https://github.com/facebook/folly/pull/944

Reviewed By: Orvid

Differential Revision: D10231693

Pulled By: yfeldblum

fbshipit-source-id: 9c0c5d7c4c1e4d9d9860c71e608e47d661a41fdd
parent a8b6dd79
...@@ -93,13 +93,13 @@ int File::release() noexcept { ...@@ -93,13 +93,13 @@ int File::release() noexcept {
return released; return released;
} }
void File::swap(File& other) { void File::swap(File& other) noexcept {
using std::swap; using std::swap;
swap(fd_, other.fd_); swap(fd_, other.fd_);
swap(ownsFd_, other.ownsFd_); swap(ownsFd_, other.ownsFd_);
} }
void swap(File& a, File& b) { void swap(File& a, File& b) noexcept {
a.swap(b); a.swap(b);
} }
......
...@@ -119,7 +119,7 @@ class File { ...@@ -119,7 +119,7 @@ class File {
/** /**
* Swap this File with another. * Swap this File with another.
*/ */
void swap(File& other); void swap(File& other) noexcept;
// movable // movable
File(File&&) noexcept; File(File&&) noexcept;
...@@ -153,6 +153,6 @@ class File { ...@@ -153,6 +153,6 @@ class File {
bool ownsFd_; bool ownsFd_;
}; };
void swap(File& a, File& b); void swap(File& a, File& b) noexcept;
} // namespace folly } // namespace folly
...@@ -191,9 +191,7 @@ class StringKeyedMap : private std::map<StringPiece, Value, Compare, Alloc> { ...@@ -191,9 +191,7 @@ class StringKeyedMap : private std::map<StringPiece, Value, Compare, Alloc> {
Base::clear(); Base::clear();
} }
void swap(StringKeyedMap& other) & { using Base::swap;
return Base::swap(other);
}
~StringKeyedMap() { ~StringKeyedMap() {
// Here we assume that map doesn't use keys in destructor // Here we assume that map doesn't use keys in destructor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment