Remove unneeded cast, reduce duplication, move declarations to their first use.
Merge pull request #210 from Dmitry-Me/removeUnneededCast

Remove unneeded cast, reduce duplication, move declarations to their fir...
Reuse const version for non-const one
Function signature is most likely wrong
Eliminate repeated virtual calls
Merge pull request #212 from Dmitry-Me/reuseConstForNonConst

Reuse const version for non-const one
Merge pull request #213 from Dmitry-Me/likelyWrongSignature

Function signature is most likely wrong
Merge pull request #214 from Dmitry-Me/duplicateVirtualCalls

Eliminate repeated virtual calls
Remove unneeded virtual calls
Merge pull request #215 from Dmitry-Me/duplicateVirtualCalls2

Remove unneeded virtual calls
Bind reference to avoid repeated accesses by index
Merge pull request #216 from Dmitry-Me/removeRepeatedIndexAccesses

Bind reference to avoid repeated accesses by index