programminga general overview in ++ an lvalue reference is declared by placing an after some type an lvalue reference then becomes synonym ( another namefor the object it references for instancestring str "hell"string rstr str/rstr is another name for str rstr +' '/changes str to "hellobool cond (&str =&rstr)/truestr and rstr are same object string bad "hello"/illegal"hellois not modifiable lvalue string bad str ""/illegalstr+"is not an lvalue string sub str substr )/illegalstr substr is not an lvalue in ++ an rvalue reference is declared by placing an &after some type an rvalue reference has the same characteristics as an lvalue reference except thatunlike an lvalue referencean rvalue reference can also reference an rvalue ( temporaryfor instancestring str "hell"string &bad "hello"/legal string &bad str ""/legal string &sub str substr )/legal whereas lvalue references have several clear uses in ++the utility of rvalue references is not obvious several uses of lvalue references will be discussed nowrvalue references are deferred until section lvalue references use # aliasing complicated names the simplest usewhich we will see in is to use local reference variable solely for the purpose of renaming an object that is known by complicated expression the code we will see is similar to the followingauto whichlist thelistsmyhashxthelists size]iffindbeginwhichlist )endwhichlist ) !endwhichlist return falsewhichlist push_backx ) reference variable is used so that the considerably more complex expression thelists[myhash( ,thelists size())does not have to be written (and then evaluatedfour times simply writing auto whichlist thelistsmyhashxthelists size]would not workit would create copyand then the push_back operation on the last line would be applied to the copynot the original lvalue references use # range for loops second use is in the range for statement suppose we would like to increment by all values in vector this is easy with for loopforint arr size)++ ++arri ]