Boost logo

Boost :

Subject: Re: [boost] [static_if] Is there interest in a `static if` emulation library?
From: Robert Ramey (ramey_at_[hidden])
Date: 2014-08-31 22:52:12


Sorry for being dense, but why is this different than the following:

lcaminiti wrote
> template< typename T >
> void assign ( T& x, T const& y ) {
> x = y;
> if(boost::has_equal_to&lt;T&gt;::value){
> assert(x == y);
> std::cout << "asserted for: " << typeid(T).name() <<
> std::endl;
> }
> else {
> std::cout << "cannot assert for: " << typeid(T).name() <<
> std::endl;
> }
> }

since the condition is known at compile time, can't the optimizer be counted
on to
compile only the corresponding code? Why doesn't this give the same effect
as
the proposal?

Robert Ramey

--
View this message in context: http://boost.2283326.n4.nabble.com/static-if-Is-there-interest-in-a-static-if-emulation-library-tp4667118p4667120.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk