Skip to content
Prev 382 / 10988 Next

[Rcpp-devel] times, dates, etc .... in the new apis

What about something like :

class Rcpp::Date similar to RcppDate.

and :

as<Date>(SEXP)
as<vector<Date>>(SEXP)
wrap<Date>(const Date& date)
wrap<vector<Date>>(const vector<Date>& date)

and maybe perhaps also:

as<time_t>(SEXP)
as<vector<time_t>>(SEXP)
wrap<time_t>( const time_t& t)
wrap<vector<time_t>>( const vector<time_t>& t)

We probably not need additional Rcpp:: classes (apart maybe from Date) 
here, so that all the wrap versions above could return a NumericVector 
but setting the attributes differently.

... actually now that I think of it, for Date we should just have to 
create:
- operator SEXP()
- Date(SEXP)

in order to get as and wrap for free (could be a good example for what 
the NEWS pretends.

Romain