From f23b8c0d859cf01e91ed38a9f8b79c2ebc534f47 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Aug 2011 14:09:41 +0000 Subject: [PATCH] No changes, just remove gratuitous inefficiency from generic wxDVC. Don't return wxDataViewMainWindow::m_selection array by value, returning a const reference to it is enough and avoids completely unnecessary memory allocations and copying of potentially large amounts of data. Also make wxDataViewMainWindow::GetSelections() const. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 7a15a68e16..d2f8fe01bf 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -519,7 +519,7 @@ public: unsigned int GetRowCount(); wxDataViewItem GetSelection() const; - wxDataViewSelection GetSelections(){ return m_selection; } + const wxDataViewSelection& GetSelections() const { return m_selection; } void SetSelections( const wxDataViewSelection & sel ) { m_selection = sel; UpdateDisplay(); } void Select( const wxArrayInt& aSelections ); @@ -4488,12 +4488,12 @@ wxDataViewItem wxDataViewCtrl::GetSelection() const int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const { sel.Empty(); - wxDataViewSelection selection = m_clientArea->GetSelections(); + const wxDataViewSelection& selections = m_clientArea->GetSelections(); - const size_t len = selection.size(); + const size_t len = selections.size(); for ( size_t i = 0; i < len; i++ ) { - wxDataViewItem item = m_clientArea->GetItemByRow(selection[i]); + wxDataViewItem item = m_clientArea->GetItemByRow(selections[i]); if ( item.IsOk() ) { sel.Add(item); -- 2.45.2