I have written a little routine "Split" and have created a header file for it.
In the main module I call Split and, when I compile, it complains as follows:

"c:\program files\microsoft visual studio 9.0\vc\include\xmemory(52) : error C2075: 'Target of operator new()' : array initialization needs curly braces
1> c:\program files\microsoft visual studio 9.0\vc\include\xmemory(155) : see reference to function template instantiation 'void std::_Construct<char[21],const char[21]>(_T1 (*),_T2 (&))' being compiled
1> with
1> [
1> _T1=char [21],
1> _T2=const char [21]
1> ]"

This relates to an argument of Split that is declared as "std::vector<char[21]> token);" in both Split.h and the calling module. I am sure of this because "21" in the error message changes when I change the "21" in the definitions.

I'm new to C++ and had never heard of the xmemory file.

My first feeling is that you can't have a template parameter be a statically sized array like that. Maybe you could try a typedef?
Topic archived. No new replies allowed.