| 335 | |
| 336 | template <typename Rvector, typename T, typename ToVectorElement> |
| 337 | Rvector to_r_vector(const std::vector<std::shared_ptr<T>>& x, |
| 338 | ToVectorElement&& to_element) { |
| 339 | R_xlen_t n = x.size(); |
| 340 | Rvector out(n); |
| 341 | for (R_xlen_t i = 0; i < n; i++) { |
| 342 | out[i] = to_element(x[i]); |
| 343 | } |
| 344 | return out; |
| 345 | } |
| 346 | |
| 347 | template <typename T, typename ToString> |
| 348 | cpp11::writable::strings to_r_strings(const std::vector<std::shared_ptr<T>>& x, |