Skip to content

Commit

Permalink
Allow the macro RAPIDJSON_DEFAULT_ALLOCATOR to be used in any namespace
Browse files Browse the repository at this point in the history
`RAPIDJSON_DEFAULT_ALLOCATOR` uses names in the namespace
`RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global
namespace.
  • Loading branch information
agate-pris committed Mar 18, 2022
1 parent 8261c1d commit 9965ab3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/rapidjson/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class GenericDocument;
User can define this to use CrtAllocator or MemoryPoolAllocator.
*/
#ifndef RAPIDJSON_DEFAULT_ALLOCATOR
#define RAPIDJSON_DEFAULT_ALLOCATOR MemoryPoolAllocator<CrtAllocator>
#define RAPIDJSON_DEFAULT_ALLOCATOR ::RAPIDJSON_NAMESPACE::MemoryPoolAllocator<::RAPIDJSON_NAMESPACE::CrtAllocator>
#endif

/*! \def RAPIDJSON_DEFAULT_STACK_ALLOCATOR
Expand Down

5 comments on commit 9965ab3

@lelit
Copy link
Contributor

@lelit lelit commented on 9965ab3 Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this cause this error on macOS?

@agate-pris
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lelit Sorry, maybe "yes". It may cause that error.

This is necessary to use RAPIDJSON_DEFAULT_ALLOCATOR outside RAPIDJSON_NAMESPACE.

I found a similar issue at CMU-Perceptual-Computing-Lab/openpose#677 and BVLC/caffe#6679. It may be able to help you.

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPYTHON_RAPIDJSON_VERSION=1.7 -I./rapidjson/include -I/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cibw-run-_y0etr2a/cp37-macosx_x86_64/build/venv/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c ./rapidjson.cpp -o build/temp.macosx-10.9-x86_64-cpython-37/./rapidjson.o -pedantic -Wno-long-long

If -std=c++11 could be added here, it might solve the problem.

@lelit
Copy link
Contributor

@lelit lelit commented on 9965ab3 Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If -std=c++11 could be added here, it might solve the problem.

Thanks a lot, I will try ASAP!

@lelit
Copy link
Contributor

@lelit lelit commented on 9965ab3 Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That solved the issue indeed, thanks again!

@agate-pris
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad I could be of service. Thanks for the report!

Please sign in to comment.