Why is reSized a pointer? You never allocate memory for it so it is not pointing to anything valid. You should just make it a plain USHORT. This has nothing to do with templates, just a simple pointer error.