The following conversions results in a run time error Invalid input type, expected 'integer' actual 'logical'
// cpp11::logicals val
cpp11::integers ints(val);
cpp11::integers ints = cpp11::as_cpp<cpp11::integers>(val);
It's not clear to me why logicals cannot be re-interpreted as integers. After all it's the same internal representation.
What is an idiomatic way to convert within cpp11 when converting at R level is not an option? Is it enough to cpp11::integers X2(Rf_coerceVector(X, INTSXP));, or do I still need to protect the converted vector?
It would be great if this information could be added to the conversion section of the vignette.
The following conversions results in a run time error
Invalid input type, expected 'integer' actual 'logical'
It's not clear to me why logicals cannot be re-interpreted as integers. After all it's the same internal representation.
What is an idiomatic way to convert within cpp11 when converting at R level is not an option? Is it enough to
cpp11::integers X2(Rf_coerceVector(X, INTSXP));
, or do I still need to protect the converted vector?It would be great if this information could be added to the conversion section of the vignette.
Thanks! `