From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,927ae253da8bb547 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-31 07:08:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jimmaureenrogers@worldnet.att.net (Jim Rogers) Newsgroups: comp.lang.ada Subject: Re: Specialization Date: 31 May 2002 07:08:36 -0700 Organization: http://groups.google.com/ Message-ID: <82347202.0205310608.2f7d634d@posting.google.com> References: <4519e058.0205300909.5bfb317d@posting.google.com> <3CF6CF7D.8000704@worldnet.att.net> NNTP-Posting-Host: 208.37.208.100 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1022854117 13620 127.0.0.1 (31 May 2002 14:08:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 31 May 2002 14:08:37 GMT Xref: archiver1.google.com comp.lang.ada:25083 Date: 2002-05-31T14:08:37+00:00 List-Id: "Sergey Koshcheyev" wrote in message news:... > "Jim Rogers" wrote in message > news:3CF6CF7D.8000704@worldnet.att.net... > > Baugereau wrote: > > > Ok so this is the difference of philosophy with STL's vector, which is > plain > > > value-oriented. > > > What I dislike here is the lack of locality of the elements, and the > need to > > > "new" every time I add an element... > > > Any comment? > > > > The difference is that in C++ you "new" the element before you add > > it to the vector (in the constructor). > > This is wrong, if you have a vector in C++ STL, then what is > stored are BigObjects, not pointers to them. There are a few tricks that can > be used to achieve this ("placement new", and also the fact that it is > possible to call object destructors manually). You got me there. My ignorant message assumed you were correct when you claimed that the C++ STL did not need to allocate nodes in its container classes. I have since done a little research on the web. I see that the STL container classes do indeed allocate objects and copy them. This is clearly documented in http://www.sgi.com/tech/stl/alloc.html After reading the above reference I see no significant difference between the problems you encountered in Ada and the way the C++ STL is currently implemented (regarding node allocation). Note that the SGI document states that their allocator uses malloc rather than new. I am not sure this is a big performance or safety advantage. It may be more flexible than the C++ new operator. You clearly understand how to use the C++ STL. Have you ever implemented the C++ STL before? I think you are only now encountering the low level details which must exist in the C++ STL. Jim Rogers