Skip to content

Can't copy proxy elements between writable vectors #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DavisVaughan opened this issue Nov 11, 2022 · 0 comments · Fixed by #391
Closed

Can't copy proxy elements between writable vectors #300

DavisVaughan opened this issue Nov 11, 2022 · 0 comments · Fixed by #391

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Nov 11, 2022

This seems fairly restrictive? I feel like you should be able to copy proxy elements of the same type from one writable vector to another.

cpp11::cpp_function("

cpp11::writable::doubles test() {
  cpp11::writable::doubles x({1, 2, 3});
  cpp11::writable::doubles y({4, 5, 6});
  
  for (R_xlen_t i = 0; i < x.size(); ++i) {
    y[i] = x[i];
  }
  
  return y;
}

")
#> object of type 'cpp11::writable::r_vector<double>::proxy' cannot be assigned because its copy assignment operator is implicitly deleted
#>     y[i] = x[i];
#>  copy assignment operator of 'proxy' is implicitly deleted because field 'data_' is of const-qualified type 'const SEXP' (aka 'SEXPREC *const')
#>     const SEXP data_;
#> error generated.
#> make: *** [/private/var/folders/41/qx_9ygp112nfysdfgxcssgwc0000gn/T/Rtmpp0Qrcn/code_13be14d8f81cc.o] Error 1
#> make: *** Waiting for unfinished jobs....
#> Error: Compilation failed.

Created on 2022-11-11 with reprex v2.0.2.9000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant