Skip to content

Commit 4b5930a

Browse files
committed
Add missing allocator-aware array and object constructors
The make_array(array, allocator_type) overload generated a compile error when it was instantiated because there was no corresponding basic_json constructor. This adds that missing constructor. A match object constructor is also added for completeness.
1 parent a3618f7 commit 4b5930a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/jsoncons/basic_json.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,12 @@ namespace jsoncons {
24352435
construct<array_storage>(ptr, tag);
24362436
}
24372437

2438+
basic_json(const array& val, semantic_tag tag, allocator_type alloc)
2439+
{
2440+
auto ptr = create_array(alloc, val);
2441+
construct<array_storage>(ptr, tag);
2442+
}
2443+
24382444
basic_json(array&& val, semantic_tag tag = semantic_tag::none)
24392445
{
24402446
auto alloc = val.get_allocator();
@@ -2450,6 +2456,12 @@ namespace jsoncons {
24502456
construct<object_storage>(ptr, tag);
24512457
}
24522458

2459+
basic_json(const object& val, semantic_tag tag, allocator_type alloc)
2460+
{
2461+
auto ptr = create_object(alloc, val);
2462+
construct<object_storage>(ptr, tag);
2463+
}
2464+
24532465
basic_json(object&& val, semantic_tag tag = semantic_tag::none)
24542466
{
24552467
auto alloc = val.get_allocator();

0 commit comments

Comments
 (0)