delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/16/22:47:56

Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++-Container-Trouble
From: frenchc AT cadvision DOT com (Calvin French)
References: <69d8am$hlg$1 AT nz12 DOT rz DOT uni-karlsruhe DOT de> <34bd78ff DOT 0 AT news DOT cadvision DOT com> <69ktst$3h7$1 AT cadmium DOT aware DOT nl>
MIME-Version: 1.0
NNTP-Posting-Host: ts9ip66.cadvision.com
Message-ID: <34bfff10.0@news.cadvision.com>
Date: 17 Jan 98 00:45:04 GMT
Organization: CADVision Development Corporation (http://www.cadvision.com/)
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>Heh ?? Make your own container ?? Is that possible ? If so how would
>you start( is there some baseclass container ??).

It's quite possible; the key is to understand what functionality you really 
want, and understand how that functionality gets it's functionality in the 
first place. To code an STL container is really no different than coding any 
other container. On the other hand, coding an STL container with as much 
functionality as a standard STL container is another issue altogether. Where 
to start? I'd say, first you'd need a real idea for a container that isn't 
already supported (one such example is rope, defined in my SGI reference but 
of course not in the gcc-STL) and decide how you'd implement it. Then take a 
look at how another container, say vector<> is implemented. I'd suspect it's 
a challenge but by no means impossible. I mean, we understand how iterators 
work, right? It's a bit strange to understand the different types of 
iterators and how they work, but once we have that, what else is there? 
Keeping in mind that begin() and end() may not make sense in all cases and 
are by no means mandatory, any templated container supporting different types 
(but by no means all types) of iterators is really an STL container. Ahh, 
actually it's not so hard after all, is it? (who am I trying to convince???)

Peach,

- Calvin -

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019