SCM-NV / ftl

The Fortran Template Library
GNU General Public License v3.0
114 stars 13 forks source link

Inheriting from ftlList #2

Closed weixing1531 closed 4 years ago

weixing1531 commented 5 years ago

subroutine NewCopyOther In the File"ftlList.F90_template" type(CAT(ftlList,FTL_TEMPLATE_TYPE_NAME)), intent(in) :: other shoud be chang to class(CAT(ftlList,FTL_TEMPLATE_TYPE_NAME)), intent(in) :: other then the subclass of CAT( ) also use this method.

robertrueger commented 5 years ago

Hm, when I wrote this I didn't really have the use case of inheriting from the FTL containers in mind. On the contrary: I sometimes ran into random compiler issues with class() instead of type() in cases where it should have been totally equivalent, e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79053 ...

What specific application do you have in mind for inheriting from ftlList? Isn't that problem better solved in another way, e.g. through composition, aka containing an ftlList in your class? Inheriting from the std containers is generally widely discouraged in the C++ world, and I think many of the arguments there also apply to the FTL containers.