Home | Community | Message Board


This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Jump to first unread post Pages: 1
OfflineSeussA
Error: divide byzero

Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 20 days
c++ standard template library / sgi extension
    #5258317 - 02/03/06 05:38 AM (17 years, 11 months ago)

Anybody have experience using hash_sets from SGI's STL extensions?  I have some code that uses an STL hash_set to hold a LOT of data.  Everything works great with acceptable run times, except for when I go to delete the hash_set.  Unfortunately, I need to iterate over the hash_set calling a dedicated destructor for each object.  The objects aren't really destroyed, simply moved to a free list.  Since hash_set iterators are const, I have been using something like the following:

Code:

while(!hSet.empty())
{
Object *obj=static_cast<Object *>hSet.front();
hSet.erase(obj);
obj->release();
}



The hash_set has anywhere from ten thousand to several hundred thousand objects (or more!) in it.  The runtime can handle linear complexity, but anything larger than O(n) is going to be too slow.
   
Ideas, anybody?  :smile:


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
Invisiblegiz
daydreamer
Male

Registered: 02/08/06
Posts: 651
Loc: EU
Re: c++ standard template library / sgi extension [Re: Seuss]
    #5287856 - 02/11/06 02:29 AM (17 years, 11 months ago)

Write a small wrapper around your objects, that will call release()
and it's const_cast anyway, not static_cast


Extras: Filter Print Post Top
OfflineTheCow
Stranger

Registered: 10/28/02
Posts: 4,790
Last seen: 15 years, 6 months
Re: c++ standard template library / sgi extension [Re: giz]
    #5289177 - 02/11/06 04:09 PM (17 years, 11 months ago)

Why are you using STL hash object? Id recommend writing your own, you could use a hash function within a hash function. So for collision detection, insertion,deletion should realistically be a lot faster. A table of hash functions basically.


Extras: Filter Print Post Top
Jump to top Pages: 1


Similar ThreadsPosterViewsRepliesLast post
* Stacks and ADTs encryptor 563 5 03/25/06 10:53 AM
by encryptor
* Help me install folding at home at my local library OJK 876 5 02/09/06 11:34 PM
by Ythan
* generating words based on a template OJK 625 3 01/04/05 04:22 PM
by ummikko
* Can Someone Give me a Flash Site Template Earth_Droid 761 3 01/25/03 04:08 PM
by rommstein2001
* Scientists teleport two different objects calgone47 1,027 2 10/18/06 04:34 PM
by Viveka
* FreeWebSpace for library kykeon 516 1 12/23/02 06:41 AM
by kykeon
* 248-Dimensional Object
( 1 2 all )
Schwip 2,676 22 04/05/07 09:33 PM
by DieCommie
* NTSC vs PAL encoding standards for DVD RogerRabbitM 1,093 4 04/13/07 01:36 PM
by RogerRabbit

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
529 topic views. 0 members, 1 guests and 0 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.019 seconds spending 0.007 seconds on 14 queries.