MSVC warned me about this code inside point_concept.hpp
inside the class boost::geometry::concepts::Point
:
template <typename P, std::size_t Dimension, std::size_t DimensionCount>
struct dimension_checker
{
static void apply()
{
P* p = 0;
geometry::set<Dimension>(*p, geometry::get<Dimension>(*p));
dimension_checker<P, Dimension+1, DimensionCount>::apply();
}
};
The code initializes p
to 0 (meaning null) and then dereferences it. This seems blatant enough that I assume it's intentional; but I can't figure out the motivation for it. Does anyone know what it might be?
(One theory I came up with: Maybe they are using *p
as a dummy value like std::declval
? You don't need to go through constructors when declaring a pointer, so you can kind of cheat by then dereferencing the pointer and getting an (albeit garbage) value.)