[Review:Algorithms] About a static clamp function

25 Sep
2011
25 Sep
'11
2:11 p.m.
Hi, Sometimes the bound values are know at compile time. Could we ensure that the compiler could optimize the following code auto res = clamp(val, 1, 100); If this is not the case, I was wondering if it is worth adding a static clamp function that has its bounds defined as template parameters. auto res = static_clamp<1,100>(val); Best, Vicente
5008
Age (days ago)
5008
Last active (days ago)
0 comments
1 participants
participants (1)
-
Vicente J. Botet Escriba