• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

actual C++ interview question

One quick note on the following:
the copy ctor should not be used, because it will be less efficient than `std::memmove`

In general: I don't think it necessarily follows. An actual (non-inlined) function call to a library function `std::memmove` wouldn't be exactly free, either (on a side-note: `std::memcpy` makes the no-overlapping assumption and should be at least as fast). I presume the person preferring it would assume that it gets inlined by the compiler. But then, so is the body of the copy ctor. And one could argue that if you really want efficiency, you may want to consider using SIMD intrinsics. But, then again, your implementations `std::memmove/memcpy` may be vectorized, too.

Overall, then, it all boils down to the actual optimizations performed by your compiler; I'd prefer to look at the generated assembly code and profile.
 
Back
Top