Summary:
Before this diff the code below compiled and did absolutely nothing of interest:
StringPiece fun();
...
fun() = "hello";
i.e. assignment to an rvalue range was allowed. Such code is almost always, if not always, in error. This diff fixes that.
Test Plan: ran unittests
Reviewed By: ldbrandy@fb.com
Subscribers: mpawlowski, net-systems@, folly-diffs@, yfeldblum
FB internal diff:
D1825360
Signature: t1:
1825360:
1423097817:
fdaaf893cd1abbe71dc857a315df7c45cb6a0bd0
constexpr Range() : b_(), e_() {
}
+ constexpr Range(const Range&) = default;
+ constexpr Range(Range&&) = default;
+
public:
// Works for all iterators
constexpr Range(Iter start, Iter end) : b_(start), e_(end) {
e_(other.end()) {
}
+ Range& operator=(const Range& rhs) & = default;
+ Range& operator=(Range&& rhs) & = default;
+
void clear() {
b_ = Iter();
e_ = Iter();