Stephan Beal <sgb...@googlemail.com> wrote: > Also, because > 'query' is-a ostringstream, you are possibly creating 2 unneeded > std::string copies here and you are definitely invoking undefined behaviour > with this part: > > sqlite3_prepare_v2(handle, query.str().c_str(), > > The problem is that query.str() returns a COPY of the string, which you > call c_str() on to get its bytes, and then the copy is destroyed.
The behavior of this fragment is in fact well defined by the C++ standard. The temporary is destroyed at the end of the full expression - basically, at the semicolon, after the function call. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users