N+1 Problem of C++ I/O system