I have a Struct with Template and there is error at constructor at Structure.
I have developed the code with VS2012, now open the project with VS2015 and I have this issue.
How can I fix it?
template<typename It>
Rect_< typename VT<typename VT<It>::value_type>::value_type > BoundingRect(It Begin,It End,int inc=0)
{
typedef typename VT<typename VT<It>::value_type>::value_type T;
struct M{
T x,X,y,Y;
M():x(std::numeric_limits<T>::max()),X(-x),y(x),Y(X){}
void operator()(const VT<It>::value_type v)
{
if(x>v.x) x=v.x;
if(X<v.x) X=v.x;
if(y>v.y) y=v.y;
if(Y<v.y) Y=v.y;
}
};
const M m( std::for_each(Begin,End,M()) );
return inc? Rect_<T>( m.x-inc, m.y-inc, m.X-m.x+inc*2, m.Y-m.y+inc*2 ):Rect_<T>( m.x, m.y, m.X-m.x, m.Y-m.y );
}
The error is at this line
M():x(std::numeric_limits<T>::max()),X(-x),y(x),Y(X){}
as C2589 '(':illegal token on right side of '::'
C2059 syntax error: ':
How to fix the errors? :'