Skip to content

ListOf<T> class #135

Description

@kevinushey

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...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions