[Lemon-devel] I can't believe
Alpár Jüttner
alpar at cs.elte.hu
Mon Apr 21 15:12:17 CEST 2008
> #include <windows.h>
> #undef max
> #undef min
#define NOMINMAX
#include <windows.h>
does this particular problem, but I see no good solution to the other
problem of my previos mail (i.e. in time_measure.h, pushing an
std:string to an ostream does not work)
Regards,
Alpar
>
> Best, Balazs
>
> On Friday 18 April 2008 17.43.23 Alpár Jüttner wrote:
> > Hi,
> >
> > MSVC compiler complains about line
> >
> > max_w=std::max(double(_arcWidths[e]),max_w);
> >
> > in graph_to_eps.h saying that
> >
> > C:\Work\lemon\cmake\lemon/graph_to_eps.h(748) : error C2589: '(' :
> > illegal token on right side of '::'
> >
> > You won't believe the reason: There seems to exist a
> >
> > #define max(a,b) (((a)>(b))?(a):(b))
> >
> > line somewhere in the windows.h header file.
> >
> > How to handle this situation? We use std::max in several places. In fact
> > it typically do not cause any problem because we don't use windows.h.
> > Even that special case can be solved if we move the windows.h dependent
> > stuff into a separate file including windows.h but not using std::max().
> > However this is still very dangerous, as a user of lemon can also
> > include windows.h.
> >
> >
> > Another 'nice' feature of MSVC:
> > In time_measure.h, will not compile the line
> >
> > _os << _title;
> >
> > but it compiles this:
> >
> > _os << _title.c_str();
> >
> > Yes, you see it right, MSVC does not allow you to push an std::string to
> > an std::ostream, but only a char *.
> >
> > Regards,
> > Alpar
> >
> >
> > _______________________________________________
> > Lemon-devel mailing list
> > Lemon-devel at lemon.cs.elte.hu
> > http://lemon.cs.elte.hu/mailman/listinfo/lemon-devel
>
>
More information about the Lemon-devel
mailing list