lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] wxWindowList::compatibility_iterator


From: Greg Chicares
Subject: Re: [lmi] wxWindowList::compatibility_iterator
Date: Wed, 30 Nov 2005 05:47:45 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2005-11-30 5:22 UTC, Greg Chicares wrote:
> Is there a reasonable and safe way to use wxWindowList::compatibility_iterator
> as one would use a standard-library iterator, e.g., incrementing it with '++'
> instead of with GetNext()?
> 
> I think I could get at the underlying iterator like this in wx-2.5.4 :
>   std::list<wxWindow*>::iterator node = GetChildren().GetFirst().m_iter;
> but in wx cvs 'm_iter' is now a private member. So I thought I'd just ask
> before spending a lot of time on this.

Oh...it's really easy: instead of

    wxWindowList::compatibility_iterator node;
    for
        (node = GetChildren().GetFirst()
        ;node
        ;node = node->GetNext()
        )
        {
        wxWindow* w = node->GetData();
        ...

just write

    for
        (wxWindowList::const_iterator node = GetChildren().begin()
        ;node                             != GetChildren().end()
        ;++node
        )
        {
        wxWindow* w = *node;
        ...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]