How to convert std::string to v8's Local<string>
This seems to work well
v8::String::Utf8Value param1(args[0]->ToString());
std::string from = std::string(*param1);
and if you're trying to convert a std::string
to a v8::String
then do
std::string something("hello world");
Handle<Value> something_else = String::New( something.c_str() );
I don't have that v8 framework on this box, but this
v8::AsciiValue av(args[0]->ToString());
std::basic_string<char> str(av);
graph->add_node(str);
should work, given graph->add_node copies the str.