[haiku-development] Re: Hello, and a BBitmap question.

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 07 Jun 2008 12:30:40 +0200 CEST

"Rene Gollent" <anevilyak@xxxxxxxxx> wrote:
> while (fParent->CountChildren() > 0) {
> fParent->RemoveChild(fParent->ChildAt(0));
> printf("%d\n", fParent->CountChildren());
> }

And since BView::CountChildren() is O(n), you should actually do:

while (true) {
        BView* view = fParent->ChildAt(0);
        if (view == NULL)
                break;

        fParent->RemoveChild(view);
}

:-)

Bye,
   Axel.


Other related posts: