2432 Commits

Author SHA1 Message Date
Kyrega
19b55c9049 No default template parameter for older compilers 2021-08-10 17:38:23 +02:00
Kyrega
128b1031b0 Use rapidjson internal::SelectIf 2021-08-10 17:38:09 +02:00
Kyrega
8710d7e989 Do not depend on c++11 conditional 2021-08-10 17:37:35 +02:00
Kyrega
e0512e0944 Using unsigned for WIStreamWrapper 2021-08-10 17:36:31 +02:00
Kyrega
7fac34f7bb Added typename 2021-08-10 17:35:49 +02:00
Kyrega
b952a592a4 Fix RawNumber for longer char types 2021-08-10 17:35:07 +02:00
Milo Yip
28c59ab4c6
Merge pull request #1922 from jack-perisich/grisu2_precision
Fix small errors in dtoa output for certain doubles
2021-08-10 22:16:46 +08:00
jack_perisich
bb06211088 Fix small errors in dtoa output for certain doubles 2021-07-27 19:50:51 -04:00
Steve Hanson
7ee918fc8f Merge branch 'master' of https://github.com/Tencent/rapidjson 2021-07-09 10:47:18 +01:00
Milo Yip
48fbd8cd20
Merge pull request #1848 from smhdfdl/id-and-ref
Fix issue 1843 - support Id keyword
2021-07-09 10:57:40 +08:00
Steve Hanson
8d16abd980 Uri Parse improvements 2021-06-30 17:09:52 +01:00
Milo Yip
b557259f88
Merge pull request #1904 from Tencent/issue1899_pointerappend
Fix Pointer::Append() crash for custom allocator on Windows
2021-06-14 22:49:09 +08:00
Steve Hanson
a21cf9f7b8 equiv fix for issue 1899 2021-06-14 11:35:00 +01:00
Milo Yip
8c29a7b493 Fix Pointer::Append() crash for custom allocator on Windows
Fix #1899
2021-06-11 11:49:14 +08:00
Steve Hanson
12b88efa6f fix coverage again 2021-06-09 18:11:04 +01:00
Steve Hanson
f6ebcb2008 fix Uri.Match optional arg 2021-06-09 16:38:40 +01:00
Steve Hanson
3df804c128 fix coverage, unit test allocators and equality 2021-06-09 10:31:09 +01:00
Steve Hanson
18ab3b16bc remove temp debug statements 2021-06-08 17:11:42 +01:00
Steve Hanson
6d253c160d remove compiler warning 2021-06-08 15:31:25 +01:00
Steve Hanson
28bcbd3f35 make std::string optional 2021-06-08 10:53:10 +01:00
Steve Hanson
494447b731 remove copyright & debug statements 2021-05-21 15:55:11 +01:00
Steve Hanson
6e58a53f44 fix coverage 2021-05-20 17:44:34 +01:00
Steve Hanson
3987d82f41 Merge branch 'master' of https://github.com/Tencent/rapidjson into id-and-ref 2021-05-20 12:20:12 +01:00
Steve Hanson
9c1002f94d rge branch 'master' of https://github.com/Tencent/rapidjson 2021-05-20 12:18:46 +01:00
Milo Yip
17aa824c92
Merge pull request #1885 from saurabhchardereal/master
Improve documentation
2021-05-07 17:00:48 +08:00
Saurabh Charde
cd737fb545
Improve documentation
Signed-off-by: Saurabh Charde <saurabhchardereal@gmail.com>
2021-05-07 14:13:33 +05:30
Milo Yip
25fa7a119d
Merge pull request #1883 from nkolotov/fix/issues/1882
Fixed -Wshadow warning.
2021-05-06 09:54:52 +08:00
N. Kolotov
3aa8d04b74 Fixed -Wshadow warning. 2021-05-03 01:56:41 +03:00
Milo Yip
e0f68a4356
Merge pull request #1877 from hendrikmuhs/windows-GetObject-conflict-#1418
add a workaround for GetObject macro defined by windows.h
2021-04-20 10:02:53 +08:00
Hendrik Muhs
3cdfde14d6 replace auto with concrete type 2021-04-19 13:15:11 -07:00
Hendrik Muhs
d179facf90 don't let the GetObject macro rewrite the GetObject method, add a GetObj alias 2021-04-19 12:29:11 -07:00
Hendrik Muhs
3168d7c343 add a test that provokes a compile time error on windows 2021-04-18 18:06:35 +02:00
Milo Yip
47b837e14a
Merge pull request #1485 from ylavic/MemberMap
Object members stored in std::multimap
2021-04-08 10:06:28 +08:00
ylavic
be4a5a9087 Turn some Tests to RAPIDJSON_USE_MEMBERSMAP in CI. 2021-04-07 18:22:46 +02:00
ylavic
fc08f4f61b Tests for Members in std::multimap. 2021-04-07 18:22:46 +02:00
ylavic
71f0fa7eb3 Set RAPIDJSON_USE_MEMBERSMAP to use a (std::multi)map for object members.
When RAPIDJSON_USE_MEMBERSMAP is defined, an object Value will store
its members in an (re)allocated array of Members like before, but also
in an std::multimap<GenericValue::Data,SizeType> where the key and value
reference the corresponding Member by its Data and index in the array,
respectively, and in a relocatable manner.

The layout of the members map/array is now:
 {multimap*}<>{capacity}<>{Member[capacity]}<>{multimap::iterator[capacity]}
where <> stands for the RAPIDJSON_ALIGN-ment of each part, if needed.

This layout needs to be reallocated when the current capacity is
exhausted, which requires to take care of the multimap and its iterators
explicitely. The multimap is allocated separately and only its pointer is
saved in this layout, so it can easily be restored in its new position.
As for the old/alive iterators, they must move to their new offset according
to the new capacity.

With this in place, it's immediate to get the multimap::iterator from a
MemberIterator and vice versa, thus the same complexity applies for the
operations with MemberIterator or MapIterator.

For FindMember() and RemoveMember(), the complexity drops from O(n) to
the multimap/rbtree's O(log n).
For EraseMember() it drops from O(n-m) to O((log n)-m), m representing
the move/copy of the trailing members.
For AddMember() though, the complexity grows from O(1) to O(log n) due to
the insertion in the multimap too.

Consequently parsing will be slower, up to ~20% measured in perftests on
my laptop (since it's mainly composed of insertions). But later work on
the Document (usually the goal of parsing...) will be much faster; the
new DocumentFind perftest included in this commit is 8 times faster with
RAPIDJSON_USE_MEMBERSMAP (still on my laptop). Overall the tests are 4%
slower (mainly composed of parsing), and notably 15% slower for schemas
parsing/validation (which supposedly comes from the larger JSON files
parsing, still). As a side note, when RAPIDJSON_USE_MEMBERSMAP is not
defined, this commit does nothing (same results for perftest with regard
to previous versions).

Finally, the multimap is allocated and constructed using StdAllocator,
so they will use the same Allocator than for any other Value allocation,
and thus will benefit from the same performance/safety/security/whatever
provided by the user given Allocator.
2021-04-07 18:22:46 +02:00
Milo Yip
7d801bbe45
Merge pull request #1503 from ylavic/sub_value_assignment
Fix (Sub-)Value assignment
2021-04-07 17:52:51 +08:00
Milo Yip
03676c9bf5
Merge pull request #1870 from ylavic/allocators_rvalues
Add rvalue copy and assignment to MemoryPoolAllocator and StdAllocator.
2021-04-07 17:39:26 +08:00
ylavic
aa0675ffd7 Try some tests with -D_GLIBCXX_DEBUG and coverage with -O0. 2021-04-04 12:51:47 +02:00
ylavic
5c764d9a81 Tests for Allocators copy by rvalue reference. 2021-04-04 12:51:47 +02:00
ylavic
683010b02d Add rvalue copy and assignment to MemoryPoolAllocator and StdAllocator. 2021-04-04 12:51:47 +02:00
ylavic
117276c413 Fix would-crash tests if the default allocator used were kNeedFree.
The allocator cannot be destroyed before the Document, otherwise the
Value destructor double frees.
2021-04-02 21:09:20 +02:00
Milo Yip
49aa0fc15d
Merge pull request #1868 from ylavic/cpp17_in_ci
Handle C++17 (and C++11 with MSVC) in CI.
2021-04-01 14:40:55 +08:00
ylavic
a8bd931766 Tests for C++17 with VS 2019. 2021-03-30 15:58:17 +02:00
ylavic
6bed9b266f Don't define StdAllocator<void> from C++17. 2021-03-30 13:47:04 +02:00
ylavic
e336667b4a Handle C++17 (and C++11 with MSVC) in CI. 2021-03-30 10:12:36 +02:00
Milo Yip
b996a23714
Merge pull request #1866 from ylavic/std_allocator_traits
Make StdAllocator C++17-20 compatible.
2021-03-30 14:31:29 +08:00
ylavic
08cf9a56c0 Make StdAllocator C++17-20 compatible. 2021-03-29 11:32:33 +02:00
ylavic
02f42604bd Make StdAllocator C++17-20 compatible. 2021-03-28 23:48:14 +02:00
Milo Yip
cd5ee4dfe9
Merge pull request #1858 from ylavic/std_allocator
Provide StdAllocator, STL compatible, for use with standard types
2021-03-25 15:22:32 +08:00