Would it be a good idea to check if a vector is empty or not before using std::transform
and back_inserter
or could nothing wrong happen since the vector.begin()
will be the same as vector.end()
and will not insert nothing in the new vector ?
This is unneeded. If empty()
is true
, then begin() == end()
and transform
will become a non-op as it works in the range [begin, end)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With