0

So, I am using std::merge and std::inplace_merge several thousand times in my code. I have read about inline keyword which is used for optimizations. So, writing my own merge functions and make it inline is gonna be useful? Or it is already optimized by the compiler?

agenius5
  • 21
  • 1
  • 5
  • Possible duplicate of https://stackoverflow.com/a/1932371/4045598 – Thomas Caissard Apr 23 '20 at 20:09
  • 1
    Can you write a better merge function for your use-case than what is provided by your standard library? If yes, go for it. If not, well, no point. – Mat Apr 23 '20 at 20:11
  • 2
    Start with the Library function. It's tried, tested and true. If the If the project requirements say you need more speed, then profile and see if the merge is the right place for an improvement. If the profiling says you need something better (and as Mat says can write something better), then do the extra work. – user4581301 Apr 23 '20 at 20:31

0 Answers0