[Development] RFC: Containers member functions for algorithm

Kevin Kofler kevin.kofler at chello.at
Fri Mar 24 19:00:57 CET 2017


Michael Winkelmann wrote:
> The reason why STL is using free function is because it separates data
> structures (aka containers) and algorithms.
> A bad example what happens if you dont separate can be seen here:
> https://www.imagemagick.org/api/Magick++/Image_8h_source.html
> 
> ...and your data structure will be bloated with member functions.

Why is that bad? It is convenient and object-oriented. Moving everything to 
freestanding functions goes against the principles of OOP.

That said, even freestanding functions would be better than the current 
boilerplate myContainer.begin(), myContainer.end() copypasta.

        Kevin Kofler




More information about the Development mailing list