operands to min and max must have the same type...

Benjamin Kosnik bkoz@redhat.com
Wed Mar 5 04:59:00 GMT 2003


>> ptrdiff_t new_size = std::max(static_cast<ptrdiff_t>(2 * old_size), ptrdiff_t (1));
>
>Err...  I don't understand.  Why must one of them be a static_cast
>while the other is ok as a functional cast?  Are conventions like this
>documented anywhere?

Sorry, in my haste I didn't notice the second. I suppose you could just
do 

ptrdiff_t(1 * old_size), ptrdiff_t(1)

(note the lack of space). 

See C++STYLE.

-benjamin



More information about the Libstdc++ mailing list