Re-fix bug 3319 with less side effects

The previous solution (#2084) has an unfortunate side-effect of breaking some operations with std::vector as a destination. See commit messages for details.