MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / cppMatrixArgToRArg

Function cppMatrixArgToRArg

src/attributes.cpp:2672–2684  ·  view source on GitHub ↗

convert a C++ Matrix to an R argument (returns empty string if no conversion possible)

Source from the content-addressed store, hash-verified

2670 // convert a C++ Matrix to an R argument (returns empty string
2671 // if no conversion possible)
2672 std::string cppMatrixArgToRArg(const std::string& cppArg) {
2673
2674 // look for Matrix
2675 std::string matrix = "Matrix";
2676 size_t matrixLoc = cppArg.find(matrix);
2677 if (matrixLoc == std::string::npos ||
2678 ((matrixLoc + matrix.length()) >= cppArg.size())) {
2679 return std::string();
2680 }
2681
2682 std::string args = cppArg.substr(matrixLoc + matrix.length());
2683 return "matrix" + args; // #nocov end
2684 }
2685
2686 // convert a C++ literal to an R argument (returns empty string
2687 // if no conversion possible)

Callers 1

cppArgToRArgFunction · 0.85

Calls 2

lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected