On Saturday, 11 August 2018 at 05:17:51 UTC, Cecil Ward wrote:
T myfunc(T)( T x, uint mask )
   if ( mask == 3 )
   {
   return fast_func( x, mask );
   }

but of course this doesn't work because mask is not known at compile-time.

Actually is there an opportunity for some kind of language enhancement there? I do not really know what I am talking about AT ALL but if the compiler could silently add an extra specialisation that gets generated at compile time, with constant folding and all the optimisations that follow from it, if a call with an appropriate constant argument is seen? But this is probably horrible because that kind of stuff is ph performed at a completely different point ?

Reply via email to