c++ - Compiler optimization problem -


most of functions in <functional> use functors. if write struct this:

struct test {    bool operator()    {        //something    }    //no member variables }; 

is there perf hit? object of test created? or can compiler optimize object away?

gcc @ least can optimize object creation , inline functor, can expect performance hand-crafted loop. of cource must compile -o2.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -