I defined a typedef and:
typedef boost::geometry::model::d2::point_xy<double> boost2dPoint;
boost2dPoint min_p;
//.
//.(under a condition: min_p will be initialized)
//.
for(Region::Iterator itv = s.beginVer(); itv != s.endVer(); ++itv )
{
Region::Point v_point = (*itv).pnt();
if( (v_point(0) == min_p.x()) && (v_point(1) == min_p.y()) )
{
return *itv;
}
}
I received a warning
‘min_p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
how can I check if min_p is initialized or not??
You cannot, at least not with that object alone. Uninitialized data is not specially marked, it just doesn't have a specified value. You could have a
bool
flag that's initially set tofalse
and set it totrue
whenmin_p
is initialized, although if you're going that route, I'd suggest usingboost::optional
:I'll leave a link to the documentation, which is not terribly long.