Better C++ readObject api