baaba
18-11-2007 13:08:55
Hello,
I'm curious as to what the rationale was behind making the NxOgre Container template not conform to the STL container protocol.
There are huge codebases (especially generic libraries) out there that rely on said protocol, not to mention a large amount of algorithms in the Standard C++ Library itself! Not conforming to the interface means that either
a) algorithms have to be duplicated
b) uses of the Container have to access the inner STL container if one is present; this may no longer be the case if Container is changed and the Container's internal state will potentially become inconsistent
c) all idiomatic uses of algorithms must be abandoned and instead the boiler-plate code written out by hand.
I argue that none of these three options are desirable. This is not a huge problem in itself as it seems the Container class is not used pervasively in NxOgre, but I suspect a lot of code built on top of NxOgre will end up using the new non-standard protocol, as there are no doubt many people learning C++ "on the go" while doing a fun game project with OGRE/NxOgre.
I believe the current interface is also very limiting because it does not support the idea of ranges. One of the key strengths of C++ compared to other languages is the ability to create elegant and efficient code through algorithmic generic abstraction, especially with respect to collections of objects and ranges of objects in said collections.
I'm curious as to what the rationale was behind making the NxOgre Container template not conform to the STL container protocol.
There are huge codebases (especially generic libraries) out there that rely on said protocol, not to mention a large amount of algorithms in the Standard C++ Library itself! Not conforming to the interface means that either
a) algorithms have to be duplicated
b) uses of the Container have to access the inner STL container if one is present; this may no longer be the case if Container is changed and the Container's internal state will potentially become inconsistent
c) all idiomatic uses of algorithms must be abandoned and instead the boiler-plate code written out by hand.
I argue that none of these three options are desirable. This is not a huge problem in itself as it seems the Container class is not used pervasively in NxOgre, but I suspect a lot of code built on top of NxOgre will end up using the new non-standard protocol, as there are no doubt many people learning C++ "on the go" while doing a fun game project with OGRE/NxOgre.
I believe the current interface is also very limiting because it does not support the idea of ranges. One of the key strengths of C++ compared to other languages is the ability to create elegant and efficient code through algorithmic generic abstraction, especially with respect to collections of objects and ranges of objects in said collections.