Sorry to bug you all, I accidently sent a wrong message few minutes ago.

I have posted this problem few days ago, can anybody helps me with this
compilation error ? I do not have idea why there is no matching function...
It is from Romain's example -
http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2010-November/001326.html.
I have attached the output of the compiling errors.

////////////////////////////////////////////////////////
class Randomizer {
public:

     Randomizer(){}

NumericVector get( int n ){
RNGScope scope ;
return runif( n, 0.0, 1.0 );
}

List get( IntegerVector n ){
RNGScope scope ;
int size = n.size() ;
List res( size) ;
for( int i=0; i<size; i++){
    res[i] = runif(n[i] , 0.0, 1.0 ) ;
}
return res ;
}

} ;

bool get_int_valid(SEXP* args, int nargs){
     if( nargs != 1 ) return false ;
     if( TYPEOF(args[0]) != INTSXP ) return false ;
     return ( LENGTH(args[0]) == 1 ) ;
}

RCPP_MODULE(mod){

class_<Randomizer>( "Randomizer" )

    .default_constructor()

.method( "get" , ( NumericVector (Randomizer::*)(int) )(
&Randomizer::get) , &get_int_valid )
.method( "get" , ( List (Randomizer::*)(IntegerVector) )(
&Randomizer::get) )
;


}

Thanks a bunch !

Attachment: overloaded.docx
Description: MS-Word 2007 document

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to