Hello, I have a question that I am sure has an easy answer, but I don’t know what it is.  I have a class in C++ called path, this class does not have a constructor from std::string in C++.  The class is not in a library I can modify.  I have extended the class in Ruby to have a constructor from std::string:

 

%extend path{

  // constructor from std::string

  path(const std::string& s){

    path *p;

    p = new path(toPath(s));

    return p;

  }

};

 

I also created a function that takes a const reference to a path:

 

void funcOnlyTakesAPath(const path& p);

 

I can call this function like:

 

p = Path.new("./here")

funcOnlyTakesAPath(p)

 

However, I cannot call this function like:

 

funcOnlyTakesAPath("./here")

 

How can I get SWIG to allow implicit conversion of std::string to path?

 

Thanks a lot,
Dan