Re: CString Array to LPCTSTR *



Thanks for the links, they tend to clarify the vector and contiguity stuff.
--
Vipin Aravind
http://www.explorewindows.com/Blogs

"Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote in message
news:8jm1h2phpvpfer0thrnja1so1ubo9giu78@xxxxxxxxxx
On Wed, 20 Sep 2006 09:22:38 +0530, "Vipin" <Vipin@xxxxxxxxxx> wrote:

Actually if you look up the container summary chapter in C++ programming
language by Stroustup, it says this:-
"For vector the element data structure is most likely an array"
It never says it *is* an array because it is an underneath implementation
detail and since array provides random access that would be the most
commonly used implementation mechanism.

For many years, people have been pointing out the C++ Standard doesn't
require vector to use contiguous storage. That omission was corrected in
the TC1, which I think came out in 2003:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#69

As far as std::string is concerened, Stroustrup mentions two possible
implementations underneath.

There are two things that are relevant here:

1. What the standard says.
2. How people have followed the standard.

I addressed both in my first reply to this thread. But wait, there's more.
The de facto contiguity requirement of std::string will be formalized in
the next TC:

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#530

--
Doug Harrison
Visual C++ MVP


.



Relevant Pages

  • Re: auto_array<> [Was: The finally debate]
    ... > objects were contiguous - hence inside an array. ... I don't know what loopholes ... > or changes have emerged since the Standard came out. ... > requires contiguity, ...
    (comp.lang.cpp)
  • Re: CString Array to LPCTSTR *
    ... It never says it *is* an array because it is an underneath implementation ... What the standard says. ... The de facto contiguity requirement of std::string will be formalized in ...
    (microsoft.public.vc.mfc)
  • Re: auto_array<> [Was: The finally debate]
    ... > objects were contiguous - hence inside an array. ... I don't know what loopholes ... > or changes have emerged since the Standard came out. ... > requires contiguity, ...
    (comp.lang.cpp)
  • Re: ALLOCATE and contiguous memory
    ... > contiguity without needing to first write a thesis explaining ... and allocatables just the same. ... array, and the corresponding actual argument is an array slice, ... to the C routine is made, or whether it was merely allocated ...
    (comp.lang.fortran)
  • Re: forrtl warning (402)
    ... | You are calling a routine that has an f77-style array argument (* as the ... | the outer, calling routine. ... but if inner is external the same assumption must be made ... but still has a chance to insert a run-time contiguity test before ...
    (comp.lang.fortran)