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

Explicitly delete fbstring_core copy-assignment (#1123)

Summary:
- Replace `fbstring_core` private copy assignment special member function
  with an explicit `=delete` equivalent.
Pull Request resolved: https://github.com/facebook/folly/pull/1123

Reviewed By: Orvid

Differential Revision: D15216597

Pulled By: yfeldblum

fbshipit-source-id: 319109f739d972e9efc73a7dbc2dd6ae401b18fc
parent 11aeda2a
......@@ -197,6 +197,7 @@ class fbstring_core_model {
public:
fbstring_core_model();
fbstring_core_model(const fbstring_core_model &);
fbstring_core_model& operator=(const fbstring_core_model &) = delete;
~fbstring_core_model();
// Returns a pointer to string's buffer (currently only contiguous
// strings are supported). The pointer is guaranteed to be valid
......@@ -243,9 +244,6 @@ class fbstring_core_model {
// the string without reallocation. For reference-counted strings,
// it should fork the data even if minCapacity < size().
void reserve(size_t minCapacity);
private:
// Do not implement
fbstring_core_model& operator=(const fbstring_core_model &);
};
*/
......@@ -311,6 +309,8 @@ class fbstring_core {
FBSTRING_ASSERT(memcmp(data(), rhs.data(), size() * sizeof(Char)) == 0);
}
fbstring_core& operator=(const fbstring_core& rhs) = delete;
fbstring_core(fbstring_core&& goner) noexcept {
// Take goner's guts
ml_ = goner.ml_;
......@@ -483,9 +483,6 @@ class fbstring_core {
}
private:
// Disabled
fbstring_core& operator=(const fbstring_core& rhs);
Char* c_str() {
Char* ptr = ml_.data_;
// With this syntax, GCC and Clang generate a CMOV instead of a branch.
......
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