Re: CString Array to LPCTSTR *

Tech-Archive recommends: Fix windows errors by optimizing your registry



Doug,
Refer Stroustrup's book where he shows one type of implementation
of string where he has a diagram with segment descriptors and each of the
entries in the descriptor table points to segments of string.

--
Vipin Aravind
http://www.explorewindows.com/Blogs

"Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote in message
news:g5e1h2t52dvsdgtjpcsdnv3tahk1p8paqm@xxxxxxxxxx
On Tue, 19 Sep 2006 23:34:43 -0400, David Wilkinson
<no-reply@xxxxxxxxxxxx>
wrote:

I believe that std::vector is guaranteed to be stored in contiguous
memory, which std::string is not.

Correct for vector, and for practical purposes, std::string is contiguous
as well. At least I've never heard of a non-contiguous std::string, and I
think someone would have to be insane to write one. If you care about the
lack of a guarantee, then you should also remember that std::string may or
may not be reference-counted, data() and c_str() may or may not throw, and
there are probably a couple of other implementation choices I'm
forgetting.
That said, every std::string I've seen has been contiguous, and data() and
c_str() cannot throw. The trend has been to abandon the hopeless form of
reference-counting permitted by the standard, and VC gave it up in version
2002. So I'd say there's a sort of de facto sane implementation that
implementers have adopted.

--
Doug Harrison
Visual C++ MVP


.



Relevant Pages

  • Re: CString Array to LPCTSTR *
    ... of string where he has a diagram with segment descriptors and each of the ... entries in the descriptor table points to segments of string. ...
    (microsoft.public.vc.mfc)
  • Re: CString Array to LPCTSTR *
    ... of string where he has a diagram with segment descriptors and each of the ... entries in the descriptor table points to segments of string. ... "For vector the element data structure is most likely an array" ...
    (microsoft.public.vc.mfc)
  • Re: CString Array to LPCTSTR *
    ... Refer Stroustrup's book where he shows one type of implementation of string where he has a diagram with segment descriptors and each of the entries in the descriptor table points to segments of string. ...
    (microsoft.public.vc.mfc)
  • Re: CString Array to LPCTSTR *
    ... of string where he has a diagram with segment descriptors and each of the ... entries in the descriptor table points to segments of string. ...
    (microsoft.public.vc.mfc)
  • Re: CString Array to LPCTSTR *
    ... I don't know how I dragged the string part in here because without string's ... internal representation being contiguous several members like c_str ... of string where he has a diagram with segment descriptors and each of the ...
    (microsoft.public.vc.mfc)