Disallow assignment to rvalue Range objects (and StringPiece in particular)
authorAndrei Alexandrescu <aalexandre@fb.com>
Wed, 4 Feb 2015 19:57:51 +0000 (11:57 -0800)
committerSara Golemon <sgolemon@fb.com>
Wed, 11 Feb 2015 02:01:59 +0000 (18:01 -0800)
commit7eaace048e3925a712e6a39c2e3d91e32b0cdc9a
treefe4d8ae028dddef647c07ab9e4d88d1be2c288ad
parent5079904b440139c731e3d79fc39c802748ae9448
Disallow assignment to rvalue Range objects (and StringPiece in particular)

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
folly/Range.h