Use std::list<> instead of wxDList in wxDocument

Get rid of the only occurrence of wxDList in wx sources and just use the
standard container directly instead.
This commit is contained in:
Vadim Zeitlin 2023-04-15 14:52:41 +01:00
parent 4f075139c3
commit dba9f1fbad
2 changed files with 5 additions and 7 deletions

View file

@ -15,8 +15,6 @@
#if wxUSE_DOC_VIEW_ARCHITECTURE
#include "wx/list.h"
#include "wx/dlist.h"
#include "wx/string.h"
#include "wx/frame.h"
#include "wx/filehistory.h"
@ -26,6 +24,8 @@
#include "wx/print.h"
#endif
#include <list>
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxDocument;
class WXDLLIMPEXP_FWD_CORE wxView;
@ -218,8 +218,7 @@ protected:
private:
// list of all documents whose m_documentParent is this one
typedef wxDList<wxDocument> DocsList;
DocsList m_childDocuments;
std::list<wxDocument*> m_childDocuments;
wxDECLARE_ABSTRACT_CLASS(wxDocument);
wxDECLARE_NO_COPY_CLASS(wxDocument);

View file

@ -153,10 +153,9 @@ bool wxDocument::CanClose()
// When the parent document closes, its children must be closed as well as
// they can't exist without the parent, so ask them too.
DocsList::const_iterator it = m_childDocuments.begin();
for ( DocsList::const_iterator end = m_childDocuments.end(); it != end; ++it )
for ( auto& childDoc : m_childDocuments )
{
if ( !(*it)->OnSaveModified() )
if ( !childDoc->OnSaveModified() )
{
// Leave the parent document opened if a child can't close.
return false;