Micro optimization in wxDisplay ctor
Don't check for the index validity if it's 0, which is the most common case, as index 0 is always valid and so we can avoid calling GetCount(), which might have a non-trivial cost, completely.
This commit is contained in:
@@ -115,7 +115,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule);
|
|||||||
|
|
||||||
wxDisplay::wxDisplay(unsigned n)
|
wxDisplay::wxDisplay(unsigned n)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( n < GetCount(),
|
wxASSERT_MSG( n == 0 || n < GetCount(),
|
||||||
wxT("An invalid index was passed to wxDisplay") );
|
wxT("An invalid index was passed to wxDisplay") );
|
||||||
|
|
||||||
m_impl = Factory().CreateDisplay(n);
|
m_impl = Factory().CreateDisplay(n);
|
||||||
|
Reference in New Issue
Block a user