Support nullable `external_ptr<>`
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- C++
- スター
- 224
- フォーク
- 52
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
r-lib/cpp11 のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
AXERA-TECH/ax-llm#77 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
games-on-whales/wolf#509 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
bug-unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NVIDIA/cuda-samples#453 ·