Support nullable `external_ptr<>`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Read cpp11/external_pointer.hpp and start with the external_pointer cases exercised by the cpp_source examples. Reproduce both nullptr and R_NilValue inputs in R; done means the chosen nullable behavior is consistent in both directions and existing external-pointer behavior remains valid.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently, a nullptr but not an R_NilValue can be assigned to an external_ptr<> object. This is inconsistent and surprising, in particular because the roundtrip works correctly the other way. Should we support this?
CC @hannes @TMonster.
library(cpp11)
# Works
cpp_source(
code = '
#include "cpp11/external_pointer.hpp"
#include "cpp11/strings.hpp"
[[cpp11::register]]
cpp11::external_pointer<int> test() {
return cpp11::external_pointer<int>(nullptr);
}
'
)
test()
#> NULL
# Fails, but perhaps shouldn't
cpp_source(
code = '
#include "cpp11/external_pointer.hpp"
#include "cpp11/strings.hpp"
[[cpp11::register]]
cpp11::external_pointer<int> test() {
return cpp11::external_pointer<int>(R_NilValue);
}
'
)
test()
#> Error: Invalid input type, expected 'externalptr' actual 'NULL'
Created on 2023-04-02 with reprex v2.0.2
- Ngôn ngữ chính
- C++
- Star
- 224
- Fork
- 52
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của r-lib/cpp11
-
Dimension error with `r_vector` Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
games-on-whales/wolf#509 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug-unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NVIDIA/cuda-samples#453 ·