Skip to content

Commit 35d65c7

Browse files
committed
improving examples to use c++11 more :-)
1 parent ae998b2 commit 35d65c7

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

example1.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int main() {
1111
// construct from a file
1212
std::ifstream file("example1.json");
1313
if(file) {
14-
json::value v1 = json::parse(file);
14+
auto v1 = json::parse(file);
1515
std::cout << stringify(v1, json::PRETTY_PRINT | json::ESCAPE_UNICODE) << std::endl;
1616
}
1717
}

example4.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
//------------------------------------------------------------------------------
88
int main() {
99

10-
// construct programmatically using object literal syntax in C++11
11-
#if __cplusplus >= 201103L
12-
json::array arr = {
10+
// construct programmatically using object literal syntax in C++11
11+
auto arr = json::array {
1312
1,
1413
2,
1514
3,
@@ -20,5 +19,4 @@ int main() {
2019
}
2120
};
2221
std::cout << stringify(arr) << std::endl;
23-
#endif
2422
}

0 commit comments

Comments
 (0)