...
This compliant solution replaces the handwritten loop with the generic standard template library algorithm std::transform()
. The call to std::transform()
accepts the range of elements to transform, the location to store the transformed values (which, in this case, is a std::inserter
object to insert them at the beginning of d
), and the transformation function to apply (which, in this case, is a simple lambda).
...