[Rcpp-devel] wrapping the copy constructor and a mutate() function using rcpp...

Tama Ma pingnang at phys.ethz.ch
Wed Oct 26 22:51:49 CEST 2011


Dear Rcpp developers,

	I have the following questions:

template <class T>
class X
{
public:
    X()  {}
    X(const X & obj_)  
       : _value(obj_._value)

    X mutate() const  
        {
             X  _new_obj;
             std::copy_if (_value.begin(), _value.end(), std::back_inserter(_new_obj._value) ,   _is_positive);
       }     

private:
    std::vector<T> _value;
};


        Now, the copy constructor and mutate() wrapping using the following gives me an error:

  Rcpp::class_<X<T> >("X")
    .constructor()
    .constructor<const X<T> &>()

    .method  ( "mutate" ,  static_cast<X (X<T>::*)() const> (&X::mutate))
    ;


	Is there a fast fix for this?

	Thank you very much!

Best regards,
Tama Ma 
(+41 78 640 50 15)

pingnang at phys.ethz.ch
www.phys.ethz.ch/~pingnang

HIT K 31.3
Institut für Theoretische Physik
Wolfgang-Pauli-Strasse 27
ETH Hönggerberg
8093 Zürich
Switzerland



More information about the Rcpp-devel mailing list