RcppR6 icon indicating copy to clipboard operation
RcppR6 copied to clipboard

S3 dispatch for templated constructors

Open richfitz opened this issue 10 years ago • 0 comments

For the case where the a class is templated on T and the constructor has args [name: T] then we should be able to dispatch on the class of T rather than forcing through the manual class selection. So rather than having to write:

constructor("classname")(object)

this should work:

constructor(object)

which could just work by making constructor generic and adding methods for the rest. In general, this would be allowable if the first argument to the constructor is T, regardless of how many parameters there are. Perhaps add a flag: s3generic: true to the YAML to trigger this?

richfitz avatar Jul 27 '15 04:07 richfitz