Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10014
| From | "Bo Persson" <bop@gmb.dk> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: string's class question |
| Date | 2011-09-10 08:31 +0200 |
| Message-ID | <9d0ekoFkjfU1@mid.individual.net> (permalink) |
| References | <a8059453-ba33-43fa-a907-e3785429d38b@s2g2000vby.googlegroups.com> |
Nephi Immortal wrote:
> I was curious to examine Microsoft’s source code. The headers are
> string, xmemory, and xutility. I could see container class and
> proxy class. They inherit into _String_val and _String_val
> inherits into basic_string.
> Why are several classes needed? Why not create single basic_string
> class? Look at Microsoft’s code here.
>
> struct _Container_base12;
> struct _Iterator_base12;
>
> // CLASS _Container_proxy
> struct _Container_proxy
> { // store head of iterator chain and back pointer
> _Container_proxy()
>> _Mycont(0), _Myfirstiter(0)
> { // construct from pointers
> }
>
> const _Container_base12 *_Mycont;
> _Iterator_base12 *_Myfirstiter;
> };
>
>
That looks like code used for iterator debugging in debug mode.
Putting it in a base class perhaps help sharing this code with other
containers?
Anyway, this is just an implementation detail that doesn't matter
much. A library is allowed to organize the code the way it wants to.
Bo Persson
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
string's class question Nephi Immortal <immortalnephi@gmail.com> - 2011-09-09 14:40 -0700 Re: string's class question "Bo Persson" <bop@gmb.dk> - 2011-09-10 08:31 +0200
csiph-web