-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
Description
Hi ,
The following test fails to compile:
const json value = {{"one", 1}, {"two", 2}};
const json::object_t* p = value.get_ptr<const json::object_t*>();
But this compiles (note the extra const):
const json value = {{"one", 1}, {"two", 2}};
const json::object_t* const q = value.get_ptr<const json::object_t* const>();
I think that the problem is the additional check for the const overload of get_ptr
and std::is_const<PointerType>::value
I think what you intended was to check that the template parameter is a "pointer-to-const" but what you are actually checking is if you got a "const pointer".
I believe the right fix is to check for "pointer-to-const" like this:
and std::is_const< typename std::remove_pointer<PointerType>::type >::value
It works in VS2015.
Reactions are currently unavailable