I think using += operator overload for basic types like int, char, char*, std::string etc.. will be easier for the users.
and This is WHAT I NEED TO DO (obviously with minimum unsafe risks)
and secondly the Example class will have several method to update data on the vector and also if some getter operation is done on Example and it returns a const X* it would be a problem for users to handle it so there will be another const problem.
Quote:The number '5' there is a literal number, which means it's temporary value that sits on the stack. As soon as the statement ex += 5 finishes, the reference to it no longer exists. I would re-think whatever you're trying to do.
Hmm I am coding something like this.
Example& Example::operator+=(const X& x){ l.push_back(&x)}
However If I change it to something like
l.push_back(SomeCopyConstructorCall(x))
I think this problem will disappear right ??