Am 05.09.2013 15:56, schrieb Mojca Miklavec:
On Thu, Sep 5, 2013 at 11:24 AM, Titus von Boxberg wrote:
Hi Mojca,

you could try

#include <algorithm>


LibrariesDlg::LibrariesDlg(wxWindow* parent, TypedResults& knownLibraries)
     : m_KnownLibraries(knownLibraries)
// do no use    , m_WorkingCopy(knownLibraries)
// ...

{
std::copy(m_KnownLibraries,
m_KnownLibraries+sizeof(m_WorkingCopy)/sizeof(m_WorkingCopy[0]),
m_WorkingCopy);
// ...
}
Dear Titus,

Thank you. I don't understand how that differentiates between whether
or not the user specified m_KnownLibraries when calling LibrariesDlg,
but the compilation succeeded with that patch.

Mojca
I'm not sure that I get what you wrote.
The code is almost equivalent.
knownLibraries is a reference. The user of the Dlg has no choice not to pass it.
m_knownLibraries is guaranteed to be initialized before the
constructor body (with the std::copy) gets executed.
There would be a problem only if in the actual code m_workingCopy would
be referenced by further member initializers of the constructor (i.e. before the std::copy
fills m_workingCopy). I didn't look into the source, so I don't know.

Whether the parameter knownLibraries is initialized to something valid and meaningful
(by the caller of the Dlg's constructor) is beyond the scope of the change.
However, since it's Code::Blocks, that might be questionnable ;-)

Regards,
Titus



_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to