mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
use static variable to return reference for
This commit is contained in:
parent
c892cbadc6
commit
77641f9b69
@ -177,7 +177,7 @@ class large_number {
|
||||
* operator overload to increment (postfix)
|
||||
**/
|
||||
large_number &operator++(int) {
|
||||
large_number tmp(_digits);
|
||||
static large_number tmp(_digits);
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
@ -212,7 +212,7 @@ class large_number {
|
||||
**/
|
||||
template <class T>
|
||||
friend large_number &operator+(const large_number &a, const T &b) {
|
||||
large_number c = a;
|
||||
static large_number c = a;
|
||||
c += b;
|
||||
return c;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user