ListOf<T> is like a List, but subsetting it should return elements of type T and hence avoid having to do casts. It was initially motivated by @romainfrancois.
Suppose we have:
typedef ListOf<NumericVector> NVList;
NVList x;
- Can we enable lvalue differentiation, rvalue differentiation, and member functions? E.g. we would like to be able to do both of these:
a. x[0] = x[0] + x[1];
b. x[0].attr("foo") = "bar";
We currently use the ListOfProxy to handle lvalue and rvalue differentiation, but the ListOfProxy object generated does not have access to these methods. Is there a clean way that we can get any methods available for a NumericVector on the proxy object returned by x[0]?
- When constructing a
ListOf<T>, should we check / coerce elements to T, or trust the user to do it? E.g. if I construct a ListOf<T> from a List should those elements be converted to T on insertion? Or should these be subclasses e.g. StrictListOf...
ListOf<T>is like aList, but subsetting it should return elements of typeTand hence avoid having to do casts. It was initially motivated by @romainfrancois.Suppose we have:
typedef ListOf<NumericVector> NVList; NVList x;a.
x[0] = x[0] + x[1];b.
x[0].attr("foo") = "bar";We currently use the
ListOfProxyto handle lvalue and rvalue differentiation, but theListOfProxyobject generated does not have access to these methods. Is there a clean way that we can get any methods available for aNumericVectoron the proxy object returned byx[0]?ListOf<T>, should we check / coerce elements toT, or trust the user to do it? E.g. if I construct aListOf<T>from aListshould those elements be converted toTon insertion? Or should these be subclasses e.g.StrictListOf...