Index: boost/property_tree/detail/ptree_utils.hpp =================================================================== --- boost/property_tree/detail/ptree_utils.hpp (revision 82806) +++ boost/property_tree/detail/ptree_utils.hpp (working copy) @@ -66,6 +66,21 @@ return result; } + // Helper to avoid gcc comparison-always-false (-Wtype-limits) warning + template + typename std::enable_if::value, bool>::type + value_outside_narrow(const Ch& ch) + { + return ch > (std::numeric_limits::max)(); + } + + template + typename std::enable_if::value, bool>::type + value_outside_narrow(const Ch& ch) + { + return ch < 0 || ch > (std::numeric_limits::max)(); + } + // Naively convert string to narrow character type template std::string narrow(const Ch *text) @@ -73,7 +88,7 @@ std::string result; while (*text) { - if (*text < 0 || *text > (std::numeric_limits::max)()) + if (value_outside_narrow(*text)) result += '*'; else result += char(*text);