如何更改 header 在 Rcpp 接口中包含守卫?
How to change header include guards in Rcpp interfaces?
我最近正在尝试学习(出色的)Rcpp 库。当我想导出我的一些 C++ 代码时,afaik 建议使用类似的东西:
// [[Rcpp::interfaces(r, cpp)]]
// [[Rcpp::export(name=".mrwr_cpp")]]
Eigen::VectorXd mrwr_(const Eigen::VectorXd& p0,
const Eigen::MatrixXd& W,
const double r)
{
// impl
}
在此示例中,// [[Rcpp::interfaces(r, cpp)]]
将使用我的 R 包的名称创建一个 header 文件(假设该包名为 diffusr
)。导出的 header (diffusr.h
) 的内容如下所示:
// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#ifndef __diffusr_h__
#define __diffusr_h__
#include "diffusr_RcppExports.h"
#endif // __diffusr_h__
有没有办法自动更改 header include guard?两个前导“_”可能会导致未定义的行为,如果我是正确的,并且是为标准库保留的 (What are the rules about using an underscore in a C++ identifier?)
最好的,
西蒙
简要说明:
"You don't",因为这是在 Rcpp 中的代码生成器中完成的,所以你必须更改 Rcpp
检查 GitHub 上的 master 分支对应于下一个版本(一两周内)作为 this was recently changed
我最近正在尝试学习(出色的)Rcpp 库。当我想导出我的一些 C++ 代码时,afaik 建议使用类似的东西:
// [[Rcpp::interfaces(r, cpp)]]
// [[Rcpp::export(name=".mrwr_cpp")]]
Eigen::VectorXd mrwr_(const Eigen::VectorXd& p0,
const Eigen::MatrixXd& W,
const double r)
{
// impl
}
在此示例中,// [[Rcpp::interfaces(r, cpp)]]
将使用我的 R 包的名称创建一个 header 文件(假设该包名为 diffusr
)。导出的 header (diffusr.h
) 的内容如下所示:
// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#ifndef __diffusr_h__
#define __diffusr_h__
#include "diffusr_RcppExports.h"
#endif // __diffusr_h__
有没有办法自动更改 header include guard?两个前导“_”可能会导致未定义的行为,如果我是正确的,并且是为标准库保留的 (What are the rules about using an underscore in a C++ identifier?)
最好的, 西蒙
简要说明:
"You don't",因为这是在 Rcpp 中的代码生成器中完成的,所以你必须更改 Rcpp
检查 GitHub 上的 master 分支对应于下一个版本(一两周内)作为 this was recently changed