I have a function which is ment to take in a string and then pass it to my c++ function add_node()
Handle<Value> Graph::add_node(const v8::Arguments& args)
{
HandleScope scope;
Graph* graph = ObjectWrap::Unwrap<Graph>(args.This());
graph->add_node( args[0]->ToString() );
std::cout << "In add node \n";
}
However I'm having trouble because all of my arguments are v8 templetes of some sort or another and I cant figure out how to switch between the two. The documentation doesn't state it clearly either.
The compiler is giving me this error
../graph/binding.cc:52:10: error: no matching member function for call to
'add_node'
graph->add_node( args[0]->ToString() );
~~~~~~~^~~~~~~~
../graph/directed_graph.h:27:7: note: candidate function not viable: no known
conversion from 'Local<v8::String>' to 'std::string &' (aka
'basic_string<char> &') for 1st argument;
void add_node( std::string & currency );
How can I switch between Local<v8::String>
and std::string &
?