Boost logo

Boost Users :

Subject: Re: [Boost-users] Choosing a variable size
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-04-12 16:25:16


John Dlugosz wrote:
> Given a template function that has two incoming integral types to work with, I
> want to declare some variables for intermediate use. How do I easily make
> a typedef for the larger of the two?

Something like this will do (untested!):

typedef typename boost::mpl::if_c< sizeof( T1 ) >= sizeof( T2 ), T1, T2 >::type larger_type;

HTH,
Gevorg


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net