POV-Ray : Newsgroups : povray.programming : C++ question Server Time
28 Jul 2024 14:28:56 EDT (-0400)
  C++ question (Message 1 to 4 of 4)  
From: Peter Popov
Subject: C++ question
Date: 17 Sep 2001 01:51:59
Message: <se3bqtkgpn9s6piqc63h444gggamm7lah0@4ax.com>
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?


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Mark Wagner
Subject: Re: C++ question
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

From: Peter Popov
Subject: Re: C++ question
Date: 17 Sep 2001 15:47:49
Message: <6mkcqt4q61cicae18hqk10ocni39d3b6to@4ax.com>
On Mon, 17 Sep 2001 02:55:54 -0400, "Mark Wagner"
<mar### [at] gtenet> wrote:

>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.

Maybe I can use a set of objects and a separate set of deleted objects
(or rather, their IDs), as an alternative. How does that look,
programming-wise?


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Mark Wagner
Subject: Re: C++ question
Date: 18 Sep 2001 00:13:35
Message: <3ba6c9ef$1@news.povray.org>
Peter Popov wrote in message <6mkcqt4q61cicae18hqk10ocni39d3b6to@4ax.com>...
>Maybe I can use a set of objects and a separate set of deleted objects
>(or rather, their IDs), as an alternative. How does that look,
>programming-wise?


Sounds like a little more work, but probably easier to debug.

--
Mark


Post a reply to this message

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