c++ - cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' -


i have c++ code snippet works fine in visual studio gives error in gcc. suggestions welcomed on how make work ?

  template <typename converttype>    inline bool parse(const std::string& input, converttype& output)   {     std::stringstream stream(input);     stream.imbue(std::locale::classic());     return (stream >> output) != null;         } 

i getting error :

 ./configuration/option.h:32:38: error: cannot bind 'std::basic_istream' lvalue 'std::basic_istream&&' /usr/include/c++/4.6/istream:852:5: error:   initializing argument 1 of 'std::basic_istream& std::operator>>(std::basic_istream&&, _tp&) [with _chart = char, _traits = std::char_traits, _tp = color]' 

(stream >> output) returns reference stream , cannot compared null. can return

return (stream >> output); 

which test stream call operator void*() const (explicit operator bool() const in c++11) invokes fail() function test if operation succeeded.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -