Return Type of operator>>()
An extremely common mistake is to forget that the functions:
RWvistream& operator>>(RWvistream&, RWCollectable*&);
RWFile& operator>>(RWFile&, RWCollectable*&);
return their results off the heap. This can result in a memory leak such as the following:
int main(){
RWCollectableString* string = new RWCollectableString;
RWFile file("mydata.dat");
// WRONG:
file >> string; // Memory leak!
// RIGHT:
delete string;
file >> string;
return 0;
}