瀏覽代碼

Add short-circuit for floating-point type assignments.

Samuel Jaffe 8 年之前
父節點
當前提交
32fa614aa3
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      json_common.hpp

+ 4 - 0
json_common.hpp

@@ -134,6 +134,10 @@ namespace json { namespace helper {
   
   template <typename J>
   void parse_numeric(J & json, char const * & data) {
+    if (std::is_floating_point<J>::value) {
+      helper::parse_double(json, data);
+      return;
+    }
     numeric_token_info info = data;
     
     if ( info.is_double || info.parse_numeric() == DOUBLE ) {