overworked examples

This commit is contained in:
Niels
2016-01-26 20:07:03 +01:00
parent 707732a53e
commit 2468631dc9
41 changed files with 91 additions and 16 deletions
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/WSW3gHHE4UcZ9K3G"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/vsDHoEGWuGiwM0oh"><b>online</b></a>
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_array() << '\n';
std::cout << j_boolean.is_array() << '\n';
std::cout << j_number_integer.is_array() << '\n';
std::cout << j_number_unsigned_integer.is_array() << '\n';
std::cout << j_number_float.is_array() << '\n';
std::cout << j_object.is_array() << '\n';
std::cout << j_array.is_array() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/pX9pR42isGha24Up"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/NTSNuQecVsmv3guC"><b>online</b></a>
+1
View File
@@ -3,5 +3,6 @@ false
false
false
false
false
true
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_boolean() << '\n';
std::cout << j_boolean.is_boolean() << '\n';
std::cout << j_number_integer.is_boolean() << '\n';
std::cout << j_number_unsigned_integer.is_boolean() << '\n';
std::cout << j_number_float.is_boolean() << '\n';
std::cout << j_object.is_boolean() << '\n';
std::cout << j_array.is_boolean() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/yBDoHvFIsRqoo7Ca"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/3ZOet3bImwKg2vMb"><b>online</b></a>
+1
View File
@@ -5,3 +5,4 @@ false
false
false
false
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_discarded() << '\n';
std::cout << j_boolean.is_discarded() << '\n';
std::cout << j_number_integer.is_discarded() << '\n';
std::cout << j_number_unsigned_integer.is_discarded() << '\n';
std::cout << j_number_float.is_discarded() << '\n';
std::cout << j_object.is_discarded() << '\n';
std::cout << j_array.is_discarded() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/Fz9sE7wOVCDCxuqw"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/a0c6rKo8VbeOBAmD"><b>online</b></a>
+1
View File
@@ -5,3 +5,4 @@ false
false
false
false
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_null() << '\n';
std::cout << j_boolean.is_null() << '\n';
std::cout << j_number_integer.is_null() << '\n';
std::cout << j_number_unsigned_integer.is_null() << '\n';
std::cout << j_number_float.is_null() << '\n';
std::cout << j_object.is_null() << '\n';
std::cout << j_array.is_null() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CwckRKEAALOpqiq7"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/z9pBPy4eSYMCZgEr"><b>online</b></a>
+1
View File
@@ -5,3 +5,4 @@ false
false
false
false
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number() << '\n';
std::cout << j_boolean.is_number() << '\n';
std::cout << j_number_integer.is_number() << '\n';
std::cout << j_number_unsigned_integer.is_number() << '\n';
std::cout << j_number_float.is_number() << '\n';
std::cout << j_object.is_number() << '\n';
std::cout << j_array.is_number() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/xVKMzHSvo4XHFyxV"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/1rel3xdea4ADiKds"><b>online</b></a>
+1
View File
@@ -2,6 +2,7 @@ false
false
true
true
true
false
false
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number_float() << '\n';
std::cout << j_boolean.is_number_float() << '\n';
std::cout << j_number_integer.is_number_float() << '\n';
std::cout << j_number_unsigned_integer.is_number_float() << '\n';
std::cout << j_number_float.is_number_float() << '\n';
std::cout << j_object.is_number_float() << '\n';
std::cout << j_array.is_number_float() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/SbPvCBbOwWkIH5RX"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/vEZZNyL8GPbAfAsJ"><b>online</b></a>
+1
View File
@@ -1,6 +1,7 @@
false
false
false
false
true
false
false
+2
View File
@@ -8,6 +8,7 @@ int main()
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_number_integer() << '\n';
std::cout << j_boolean.is_number_integer() << '\n';
std::cout << j_number_integer.is_number_integer() << '\n';
std::cout << j_number_unsigned_integer.is_number_integer() << '\n';
std::cout << j_number_float.is_number_integer() << '\n';
std::cout << j_object.is_number_integer() << '\n';
std::cout << j_array.is_number_integer() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CVMYqyeIFOKcBZZU"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/bulo75cZB0cPINgL"><b>online</b></a>
+1
View File
@@ -1,6 +1,7 @@
false
false
true
true
false
false
false
+27
View File
@@ -0,0 +1,27 @@
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_number_unsigned()
std::cout << std::boolalpha;
std::cout << j_null.is_number_unsigned() << '\n';
std::cout << j_boolean.is_number_unsigned() << '\n';
std::cout << j_number_integer.is_number_unsigned() << '\n';
std::cout << j_number_unsigned_integer.is_number_unsigned() << '\n';
std::cout << j_number_float.is_number_unsigned() << '\n';
std::cout << j_object.is_number_unsigned() << '\n';
std::cout << j_array.is_number_unsigned() << '\n';
std::cout << j_string.is_number_unsigned() << '\n';
}
+1
View File
@@ -0,0 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/h4s4VitQ3VmCOEXr"><b>online</b></a>
+8
View File
@@ -0,0 +1,8 @@
false
false
false
true
false
false
false
false
+2
View File
@@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_object() << '\n';
std::cout << j_boolean.is_object() << '\n';
std::cout << j_number_integer.is_object() << '\n';
std::cout << j_number_unsigned_integer.is_object() << '\n';
std::cout << j_number_float.is_object() << '\n';
std::cout << j_object.is_object() << '\n';
std::cout << j_array.is_object() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/uXT6peoqwN6DIFAr"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/40lrBaplftujclBr"><b>online</b></a>
+1
View File
@@ -2,6 +2,7 @@ false
false
false
false
false
true
false
false
+2
View File
@@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_primitive() << '\n';
std::cout << j_boolean.is_primitive() << '\n';
std::cout << j_number_integer.is_primitive() << '\n';
std::cout << j_number_unsigned_integer.is_primitive() << '\n';
std::cout << j_number_float.is_primitive() << '\n';
std::cout << j_object.is_primitive() << '\n';
std::cout << j_array.is_primitive() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/f5AMxY70IoQ4o0wb"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/zZYJHMvzYyYkNoAU"><b>online</b></a>
+1
View File
@@ -2,6 +2,7 @@ true
true
true
true
true
false
false
true
+2
View File
@@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_string() << '\n';
std::cout << j_boolean.is_string() << '\n';
std::cout << j_number_integer.is_string() << '\n';
std::cout << j_number_unsigned_integer.is_string() << '\n';
std::cout << j_number_float.is_string() << '\n';
std::cout << j_object.is_string() << '\n';
std::cout << j_array.is_string() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/ILh5L9NsOSQ29Cg4"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/1x7B5XrHtV8RTROC"><b>online</b></a>
+1
View File
@@ -4,4 +4,5 @@ false
false
false
false
false
true
+2
View File
@@ -9,6 +9,7 @@ int main()
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
@@ -18,6 +19,7 @@ int main()
std::cout << j_null.is_structured() << '\n';
std::cout << j_boolean.is_structured() << '\n';
std::cout << j_number_integer.is_structured() << '\n';
std::cout << j_number_unsigned_integer.is_structured() << '\n';
std::cout << j_number_float.is_structured() << '\n';
std::cout << j_object.is_structured() << '\n';
std::cout << j_array.is_structured() << '\n';
+1 -1
View File
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/D9WgQUo2eieU7kqs"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/kXpxIk6MP6OxEvwu"><b>online</b></a>
+1
View File
@@ -2,6 +2,7 @@ false
false
false
false
false
true
true
false