Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Free STL compatible C++ tree container

Reply
Thread Tools

Re: Free STL compatible C++ tree container

 
 
Juha Nieminen
Guest
Posts: n/a
 
      08-07-2012
Leigh Johnston <> wrote:
> http://i42.co.uk/stuff/tree.htm


Btw, an optimization commonly used in STL implementations with regards
to the assign() function of most data containers (especially those that
allocate individual elements) is to reuse existing elements while
assigning, rather than first clearing the entire data container and
then inserting the elements.

In other words, when assigning (with the assign() member function),
the input values are assigned to any existing elements of the container.
If the container had less elements than what is being assigned, the rest
are then inserted to the end normally, and it had more, the extra is
removed normally.

This has the obvious advantage that the amount of allocations and
deallocations is minimized, making the assignment faster (and reducing
memory fragmentation).
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Free STL compatible C++ tree container Ansel C++ 1 08-16-2012 05:21 AM
Re: Free STL compatible C++ tree container Luca Risolia C++ 12 08-11-2012 10:22 AM
Re: Free STL compatible C++ tree container TDH1978 C++ 6 08-10-2012 09:01 PM
Thread-safe STL-compatible Wrapper Container Nordlöw C++ 2 04-16-2008 03:04 PM
Copy elements from one STL container to another STL container Marko.Cain.23@gmail.com C++ 4 02-16-2006 05:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57