Simplify the code
authorpxli168 <pxli168@163.com>
Mon, 17 Feb 2014 02:21:18 +0000 (10:21 +0800)
committerpxli168 <pxli168@163.com>
Mon, 17 Feb 2014 02:21:18 +0000 (10:21 +0800)
Simplify the code as @SpecLad suggested.

modules/core/src/command_line_parser.cpp

index 8b7fcad..0fa3304 100644 (file)
@@ -65,8 +65,7 @@ static void from_str(const String& str, int type, void* dst)
     {
         std::string temp;
         ss >> temp;
-        if( !temp.compare("true") ) *(bool*)dst = true;
-        else *(bool*)dst = false;
+        *(bool*) = temp == "true";
     }
     else if( type == Param::UNSIGNED_INT )
         ss >> *(unsigned*)dst;