请考虑以下CPP函数
// [[Rcpp::exp或t]]
int timesTwo(int x) {
return x * 2;
}
如果我在这个函数中输入了一个错误类型的对象(例如"字符"),显然,它将无法工作并显示此错误消息
Err或: Not compatible with requested type: [type=character; target=integer].
然而,我想让它变得更有信息性,例如
Err或 in timesTwo(int x)
Err或: Not compatible with requested type: [type=character; target=integer].
或
Err或 in the parameter x of timesTwo(int x)
Err或: Not compatible with requested type: [type=character; target=integer].
我想知道我怎样才能在CPP中做到这一点?