POV-Ray : Newsgroups : povray.programming : C++ question : Re: C++ question Server Time
28 Jul 2024 12:27:46 EDT (-0400)
  Re: C++ question  
From: Mark Wagner
Date: 17 Sep 2001 02:55:09
Message: <3ba59e4d@news.povray.org>
Peter Popov wrote in message ...
>I want to have a container of objects which stores unique entities
>like a set does, but instead of rejecting the insertion of duplicate
>entries, they should be deleted. Subsequent attempts to insert an
>already deleted object should be rejected. How should I go about it in
>the most efficient way?


If I understand you correctly, you want a data container that, when you add
something the first time, accepts it.  If you add it a second time, it gets
deleted instead, and if you add it more times, it doesn't get added?  If
this is correct, the easiest way to do this is to add a "deleted" flag to
each object when you add it.  When you remove the object, it doesn't
actually get deleted, but instead gets marked as being deleted, so you can
see if it has already been added later.

--
Mark


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.