This function is part of a larger project for my c++ class. When I try to run it on visual c++ 2017 I get the following warning:
warning C4172: returning address of local variable or temporary: temp
Item& Item::operator++(int n) {
//Increments the code to be printed on the next insertion and returns the
//value before incrementation.
Item temp = *this;
code++;
return temp;
}
Is there a way to remove this warning and still return the value before the incrementation? Thanks.