`--productKey.end()` is not standard-conforming. A `std::vector` implementation is allowed to use pointers as iterators, and you can't modify RValue scalar values. Unfortunately, you can't use `std::prev()` either since it's C++11, so you would need a variable. But if the string is nullterminated, you can also use `joystickDescription = &productKey[0]`.