d2bea0c228
C++ 20 adds a new feature called "ranges", which provides components for dealing with sequences of values: https://en.cppreference.com/w/cpp/ranges. A range is like a normal object containing `begin` and `end`, except there are also composable operations like maps, filters, joins, etc. The iterator objects returned by a range's `begin` and `end` require a more strict set of operations than is needed for a range-for loop. This PR adds the extra operations needed to support turning `dom::array` and `dom::object` into a range. This PR does not depend on any C++ 20 behavior, the added operators are all valid C++ 11, and are already part of the LegacyIterator concepts. This PR adds extra code behind: `#if defined(__cpp_lib_ranges)` guards, which is the new C++ 20 specified feature test macro for ranges support. When ranges support is detected, extra compile time checks are added to ensure that `dom::array` and `dom::object` satisfy the range concept. No runtime tests have been added yet because these compile time checks should be sufficient. If desired, the `static_assert` code could be moved out of the actual code headers and put into a test file. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
README.md | ||
amalgamate.sh | ||
amalgamate_demo.cpp | ||
simdjson.cpp | ||
simdjson.h |
README.md
Try : c++ -O3 -std=c++17 -pthread -o amalgamate_demo amalgamate_demo.cpp && ./amalgamate_demo ../jsonexamples/twitter.json ../jsonexamples/amazon_cellphones.ndjson