Skip to content

Member size() fails for Matrix objects #605

@helmingstay

Description

@helmingstay

Using Debian stretch, g++ 6.2.0-13, R version 3.3.2 (2016-10-31), Rcpp_0.12.8
Tested with NumericMatrix, Integer Matrix, LogicalMatrix

> sourceCpp('size.cpp')
size.cpp: In function ‘void test_mat(Rcpp::NumericMatrix)’:
size.cpp:13:18: error: request for member ‘size’ is ambiguous
     Rcout << obj.size();

size.cpp:

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
void test_vec(NumericVector obj){
    Rcout << obj.size();
    Rcout << obj.length();
}

// [[Rcpp::export]]
void test_mat(NumericMatrix obj){
    //problem:
    Rcout << obj.size();
    Rcout << obj.length();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions