{"action":"closed","issue":{"url":"https://api.github.com/repos/nodejs/nan/issues/410","labels_url":"https://api.github.com/repos/nodejs/nan/issues/410/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/nan/issues/410/comments","events_url":"https://api.github.com/repos/nodejs/nan/issues/410/events","html_url":"https://github.com/nodejs/nan/issues/410","id":100343097,"number":410,"title":"Template function that used Local handler not working because of MaybeLocal","user":{"login":"JCMais","id":1041647,"avatar_url":"https://avatars.githubusercontent.com/u/1041647?v=3","gravatar_id":"","url":"https://api.github.com/users/JCMais","html_url":"https://github.com/JCMais","followers_url":"https://api.github.com/users/JCMais/followers","following_url":"https://api.github.com/users/JCMais/following{/other_user}","gists_url":"https://api.github.com/users/JCMais/gists{/gist_id}","starred_url":"https://api.github.com/users/JCMais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JCMais/subscriptions","organizations_url":"https://api.github.com/users/JCMais/orgs","repos_url":"https://api.github.com/users/JCMais/repos","events_url":"https://api.github.com/users/JCMais/events{/privacy}","received_events_url":"https://api.github.com/users/JCMais/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-11T15:46:26Z","updated_at":"2015-08-11T15:54:26Z","closed_at":"2015-08-11T15:54:26Z","body":"I'm having some trouble converting the following template to NAN 2\r\n\r\n```cpp\r\ntemplate <typename> struct ResultCanBeNull : std::false_type {};\r\ntemplate <> struct ResultCanBeNull<char*> : std::true_type {};\r\n\r\ntemplate<typename TResultType, typename Tv8MappingType>\r\nv8::Local<v8::Value> Curl::GetInfoTmpl( const Curl *obj, int infoId )\r\n{\r\n    NanEscapableScope();\r\n\r\n    TResultType result;\r\n\r\n    CURLINFO info = (CURLINFO) infoId;\r\n    CURLcode code = curl_easy_getinfo( obj->curl, info, &result );\r\n\r\n    v8::Local<v8::Value> retVal = NanUndefined();\r\n\r\n    if ( code != CURLE_OK ) {\r\n\r\n        Curl::ThrowError( \"curl_easy_getinfo failed!\", curl_easy_strerror( code ) );\r\n\r\n    } else {\r\n\r\n        //null pointer\r\n        if ( ResultCanBeNull<TResultType>::value && !result ) {\r\n\r\n            retVal = NanNew<v8::String>( \"\" ); //line:1102\r\n\r\n        } else {\r\n\r\n            retVal = NanNew<Tv8MappingType>( result ); //line:1106\r\n        }\r\n\r\n    }\r\n\r\n    return NanEscapeScope( retVal );\r\n}\r\n```\r\n\r\nTv8MappingType can be of type v8::Number or v8::String, as Nan::New\\<v8::String\\> now returns a MaybeLocal handler, the code is not compiling.\r\n\r\n```\r\n..\\src\\Curl.cc(1102): error C2679: binary '=': no operator found which takes a right-hand operand of type 'Nan::MaybeLocal<v8::String>' (\r\nor there is no acceptable conversion)\r\n..\\src\\Curl.cc(1106): error C2679: binary '=': no operator found which takes a right-hand operand of type 'Nan::MaybeLocal<v8::String>' (\r\nor there is no acceptable conversion)\r\n```\r\n\r\nChanging retVal to MaybeLocal is not going to work, because Nan::New\\<v8::Number\\> returns a Local handler directly.\r\n\r\nAny help would be greatly appreciated. \r\n\r\nOriginal code at https://github.com/JCMais/node-libcurl/blob/develop/src/Curl.cc#L1078"}}