Closed ridoo closed 10 years ago
Both methods have the same body so the discussion addressing this (or a similar topic) on stackoverflow won't apply here, will it?
In c++ the const behind the last bracers is part of the method signature so they are different functions. The const variant methodis different though as it returns a const pointer while the other doesnt(this isnt correct in your code paste above). They are used in different scenarios. The factories themselves are functions pointers inside the masterfactory (may change in the future, not sure yet) so the const makes sense as they are pare of the state of the masterfactory and may or may not change (depending on the variant used)
Well, what I see problematic here is just duplicate code. What about the good practice for const 'duplicates' described in the discussion on stackoverflow?
It seems that
kernel.h
defines duplicate template methods. Signatures just differ by aconst
expression:line 126:
line 140:
I would go for the
const
version as it guarantees that no state changes occur.