replace typeid() with is_unsigned()
This commit is contained in:
parent
776743bb6c
commit
d31f4f4096
@ -4,7 +4,7 @@
|
||||
|
||||
## HEAD ##
|
||||
|
||||
_none_
|
||||
* Throws an exception when trying to parse a negative number as an unsigned integer.
|
||||
|
||||
## 0.6.0 ##
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
|
||||
#include "yaml-cpp/binary.h"
|
||||
#include "yaml-cpp/node/impl.h"
|
||||
@ -134,11 +134,7 @@ inner_encode(const T& rhs, std::stringstream& stream){
|
||||
const std::string& input = node.Scalar(); \
|
||||
std::stringstream stream(input); \
|
||||
stream.unsetf(std::ios::dec); \
|
||||
if ((stream.peek() == '-') && \
|
||||
(typeid(rhs) == typeid(unsigned) || \
|
||||
typeid(rhs) == typeid(unsigned short) || \
|
||||
typeid(rhs) == typeid(unsigned long) || \
|
||||
typeid(rhs) == typeid(unsigned long long))) { \
|
||||
if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
|
||||
return false; \
|
||||
} \
|
||||
if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) { \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user