Add workaround for old broken compilers that don't support template construct/assign to containers. Fixes #6680.