Some 64-bit integers cannot be represented losslessly as a double.
Due to a typo in the operator==, the comparison has been performed
after a double conversion in too many cases.
Added basic detection of `noexcept` support for some compilers, added
corresponding RAPIDJSON_NOEXCEPT annotations to
* non-allocating constructors
* (move) assignment
* Swap
Some compilers warn about the missing initialisation of the std::exception
base class of the AssertException helper. The simplest solution is to
inherit from std::logic_error instead, which provides all of the required
functionality already.
This commit adds an IsGenericValue meta function to match arbitrary
instantiations of the GenericValue template (or derived classes).
This meta function is used in the SFINAE-checks to avoid matching
the generic APIs (operator=,==,!=; AddMember, PushBack) for instances
of the main template. This avoids ambiguities with the GenericValue
overloads.
Several GenericValue functions take a const-reference to another GenericValue
only. These functions can safely accept values with a different allocator
type.
The following functions are therefore extended by a SourceAllocator template
parameter in this commit:
- operator==/!=/[]
- HasMember, FindMember, RemoveMember
- StringEqual
Before applying the simplifications in ed282b814, the SFINAE check for the
GenericValue(bool) constructor has been broken in MSVC 2005. Add a static
assert as a safe-guard against future reappearance of this problem.
In order to match GenericValue and its derived classes for the
SFINAE-implementation of some of the operators/functions, this
meta-function matches all types equal to or derived from a given
class. See std::is_base_of<B,D> available in C++11.
Define RAPIDJSON_HAS_CXX_TYPETRAITS to use the C++11 implementation.
Some (older) compilers have problems with compile-time constants.
This commit simplifies the implementation of the helper classes
in order to improve compiler support, especially be removing the
need of partial template specialisation.
No functional changes.
Prepare equalto_operator tests to test comparisons between
* GenericValue and GenericDocument
* GenericValue with different SourceAllocator types
Both combinations currently fail due to ambiguities with the
templated operators on several compilers.
As reported in #113, recent versions of Clang complain about
ambiguous overloads for some comparison operator instantiations,
especially if the deduced template type is a GenericValue.
Add an explicit, non-templated version for now (which is a better
match).
This only solves part of the problem, as comparisons between
* GenericValue & GenericDocument
* GenericValue with different SourceAllocator types
will still cause ambiguities.