about loop-invariant optimization# Programming - 葵花宝典
c*e
1 楼
dont know how smart compiler is:
for example:
my_map::iter iter;
for (iter = map.upper_bound(key);
iter != map.lower_bound (key);
++iter)
{
//traverse element, all const/irrelavant func to map
}
will the lower_bound call be optimized when loop-invariant is turned on?
what about this case?
my_map::iter iter;
for (iter = map.upper_bound(key);
iter != map.lower_bound (key);
for example:
my_map::iter iter;
for (iter = map.upper_bound(key);
iter != map.lower_bound (key);
++iter)
{
//traverse element, all const/irrelavant func to map
}
will the lower_bound call be optimized when loop-invariant is turned on?
what about this case?
my_map::iter iter;
for (iter = map.upper_bound(key);
iter != map.lower_bound (key);