diff --git a/samples/Jzon.cpp b/samples/Jzon.cpp index dfff643d..436db661 100644 --- a/samples/Jzon.cpp +++ b/samples/Jzon.cpp @@ -1001,7 +1001,7 @@ namespace Jzon else { // Store the unknown token, so we can show it to the user - data.push(MakePair(Value::VT_STRING, valueBuffer)); + data.push(std::make_pair(Value::VT_STRING, valueBuffer)); tokens.push(T_UNKNOWN); } @@ -1022,7 +1022,7 @@ namespace Jzon } bool Parser::assemble() { - std::stack > nodeStack; + std::stack > nodeStack; std::string name = ""; @@ -1059,7 +1059,7 @@ namespace Jzon node = new Object; } - nodeStack.push(MakePair(name, node)); + nodeStack.push(std::make_pair(name, node)); name.clear(); break; } @@ -1081,7 +1081,7 @@ namespace Jzon node = new Array; } - nodeStack.push(MakePair(name, node)); + nodeStack.push(std::make_pair(name, node)); name.clear(); break; } @@ -1186,7 +1186,7 @@ namespace Jzon } else { - nodeStack.push(MakePair(name, node)); + nodeStack.push(std::make_pair(name, node)); name.clear(); } } @@ -1256,7 +1256,7 @@ namespace Jzon c1 = c2; } - data.push(MakePair(Value::VT_STRING, str)); + data.push(std::make_pair(Value::VT_STRING, str)); } bool Parser::interpretValue(const std::string &value) { @@ -1266,15 +1266,15 @@ namespace Jzon if (upperValue == "NULL") { - data.push(MakePair(Value::VT_NULL, std::string(""))); + data.push(std::make_pair(Value::VT_NULL, std::string(""))); } else if (upperValue == "TRUE") { - data.push(MakePair(Value::VT_BOOL, std::string("true"))); + data.push(std::make_pair(Value::VT_BOOL, std::string("true"))); } else if (upperValue == "FALSE") { - data.push(MakePair(Value::VT_BOOL, std::string("false"))); + data.push(std::make_pair(Value::VT_BOOL, std::string("false"))); } else { @@ -1290,7 +1290,7 @@ namespace Jzon if (number) { - data.push(MakePair(Value::VT_NUMBER, value)); + data.push(std::make_pair(Value::VT_NUMBER, value)); } else { diff --git a/samples/Jzon.h b/samples/Jzon.h index e8ff8d6d..cb2566cc 100644 --- a/samples/Jzon.h +++ b/samples/Jzon.h @@ -40,31 +40,12 @@ THE SOFTWARE. namespace Jzon { - #ifdef _MSC_VER - # pragma warning(disable : 4251) - #endif - - template - struct Pair - { - Pair(T1 first, T2 second) : first(first), second(second) - {} - - T1 first; - T2 second; - }; - template - static Pair MakePair(T1 first, T2 second) - { - return Pair(first, second); - } - class Node; class Value; class Object; class Array; - typedef Pair NamedNode; - typedef Pair NamedNodePtr; + using NamedNode = std::pair; + using NamedNodePtr = std::pair; class TypeException : public std::logic_error { @@ -449,7 +430,7 @@ namespace Jzon std::size_t jsonSize; std::queue tokens; - std::queue > data; + std::queue > data; std::size_t cursor;