Изменение возвращаемого значения фундаментального типа и типа класса

Есть такой код:

#include <iostream>
#include <string>

int returnnumber() { return 2; }
std::string returntext() { return "siema"; }

int main() {

    std::cout << (returntext() += "cze") << std::endl; // siemacze
    //std::cout << (returnnumber() += 2) << std::endl; error: lvalue required as left operand of assignment

    return 0;
} 

Почему можно изменить возвращаемое значение std::string, но не int?

11
задан scdmb 22 October 2011 в 17:08
поделиться