Topic: Getting around std::string's hiding of character pointer
Author: "nnrp.digex.net" <x@x.com>
Date: 1997/11/12 Raw View
i'd like to use the std::string class as often as possible, however there
are many situations (like when using with an RDBMS) where i'd like access to
the character buffer pointer so that i can avoid an extra copy but cannot do
so because the buffer pointer is private to std::string. has there been any
discussion or agreed upon workarounds to this problem?
i'd like to be able to do something like this...
string database_field;
database_field.reserve(100);
database_field.claim_buffer();
DBAPI.get_value("col_name", database_field.ptr); // not really important,
shows need for ptr
database_field.release();
does anyone have any recommendations or possible implementations to refer me
to?
thank you.
jwr
--------------------------------------------------------------------------
j o e l r e e d @ y a h o o . c o m
d e v e l o p m e n t . d i m e n s i o n s . i n t e r n a t i o n a l
--------------------------------------------------------------------------
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]