Closed cnsoft closed 9 years ago
The operator= for the class Value has only been defined as
Value &operator=(const Value &src);
So when you write:
val["positionx"] = 10;
A Value instance is implicitly created using the following constructor:
Value(int newInt);
So in your example, the call to setInt(10) is probably much faster than using the operator=
To improve the operator=, I will overload the operator= to accept the same types as the constructors.
e.g:
val["positionx"] = 10; val["positionx"].setInt(10);
is there some different with the two different function call?