Closed
Description
#include "cpp11.hpp"
using namespace cpp11::literals;
[[cpp11::register]]
cpp11::data_frame test_wrong() {
cpp11::doubles time({123456});
time.attr("class") = cpp11::strings({"POSIXct", "POSIXt"});
time.attr("tzone") = cpp11::strings({"UTC"});
return cpp11::data_frame({
"time"_nm = time
});
}
[[cpp11::register]]
cpp11::data_frame test_right() {
cpp11::writable::doubles time({123456});
time.attr("class") = cpp11::strings({"POSIXct", "POSIXt"});
time.attr("tzone") = cpp11::strings({"UTC"});
return cpp11::writable::data_frame({
"time"_nm = time
});
}
> str(test_wrong())
List of 1
$ time: num 123456
> str(test_right())
'data.frame': 1 obs. of 1 variable:
$ time: POSIXct, format: "1970-01-02 10:17:36"
Issues:
- setting attributes on non-writable objects has no effect but does not trigger compile or run-time errors
- initialization list
cpp11::data_frame
constructor produces a list instead of a data frame
Metadata
Metadata
Assignees
Labels
No labels