我将rapidjson.h中RAPIDJSON_ASSERT的定义修改为:
#define RAPIDJSON_ASSERT(x) (if(!(x)) throw std::logic_error("Rapidjson assertion error") )
但是程序仍然在document.h第1103行中中止。有人知道为什么吗?谢谢。
template <typename SourceAllocator>
GenericValue& operator[](const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator member = FindMember(name);
if (member != MemberEnd())
return member->value;
else {
RAPIDJSON_ASSERT(false); // line 1103. see above note
// This will generate -Wexit-time-destructors in clang
// static GenericValue NullValue;
// return NullValue;
// Use static buffer and placement-new to prevent destruction
static char buffer[sizeof(GenericValue)];
return *new (buffer) GenericValue();
}
}