[Rcpp-devel] ambiguous overload for ‘operator[]’

Kaveh Vakili Kaveh.Vakili at ulb.ac.be
Thu Oct 28 00:22:01 CEST 2010

trying to feed the beast something line by line (if this works to the end it may become an instance of quickselect() :)

	int k = Rcpp::as<int>(kr);  
	NumericVector pdA(pdAr);
	int n = pdA.size();
	//double *pdB = new double [n] ;	
	//becomes this?
	std::vector<double>* v = new std::vector<double>;
	Rcpp::XPtr< std::vector<double> > pdB(v) ;
	double dAx, dBuffer ;		
	int l = 0, lr = n - 1, jnc, j ;

	memcpy (pdB, pdA, n * sizeof (double)) ;

	while (l < lr){
		dAx = pdB[k];

This last line gives: 

filef9889ff.cpp:45: error: ambiguous overload for ‘operator[]’ in ‘pdB[k]’

Also, i patched together the piece i found on the examples/tests so fare...probably a strange patchwork for you :)

More information about the Rcpp-devel mailing list