1. 3
  1.  

  2. 3

    The author mentions returning a vector from a function as being costly without the use of move semantics, this is inaccurate. Return Value Optimization is what makes returning a vector from a function cheap, and using std::move on your return value is actually a pessimization of your code.

    1. 1

      Do you have a source for that? I want to know more about it, but searching doesn’t give me anything useful.

      1. 1

        Currently, he says “don’t even get me started on” that subject, without using std::move on his return value.

        1. 1

          I have no problem with this, but the parenthesis with “again, prior to the magic of move semantics” could lead someone to think they need to use std::move or have costly copies.

      2. 1

        Doesn’t look very efficient to me. Sure, you avoid the reallocation cost—which will be the biggest one—but if T is small you can get major gains by accessing the raw pointer and using simd.

        1. 1

          The other issue with this article is that author mentions that inline is required to not break ODR rule, but template themselves are exceptions to this rule. This reminds me how many details are there in C++ that you have to pay attention to.