Skip to content

Can't copy proxy elements between writable vectors #300

Closed
@DavisVaughan

Description

@DavisVaughan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions