I have made a winform app where i have used vectors of array[n][n] type using
typedef char myarray[9][9];
typedef vector<myarray> array3d;
as far as i have read, this feature is provided in c++0x. I am using visual studio 2010 ultimate is the error in xmemory because of this? The ide is showing no other error exept from this (not even where the above code is)
'Target of operator new()' : array initialization needs curly braces
pointing to this code in xmemory
void construct(pointer _Ptr, _Ty&& _Val)
{ // construct object at _Ptr with value _Val
::new ((void _FARQ *)_Ptr) _Ty(_STD forward<_Ty>(_Val));
}
In a code of over 2.5 k lines how do i find where’s the problem?
EDIT:
Since the problems seem with vectors here are all the operations that i do with vectors
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef char myarray[9][9];
typedef string string_array[9][9];
void function2(vector<string_array>*my_3d_string_array, int d)
{
string::iterator it;
int j,cl;
it=find((*my_3d_string_array)[d][j][cl].begin(),(*my_3d_string_array)[d][j][cl].end(),3);
(*my_3d_string_array)[d][2][3].erase(it);
}
void function(vector<string_array>*my_3d_string_array, int d)
{
(*my_3d_string_array)[d][3][4] = 2;
function2(my_3d_string_array,d);
}
int main()
{
myarray matrix;
string_array string_matrix;
std::vector<myarray> my_3d_array;
std::vector<string_array> my_3d_string_array;
// fill_matrix(matrix);
// fill_string_matrix(string_matrix)
int d;
function(&my_3d_string_array, d); // passing pointer to vector to a function d is the 3rd dimention
my_3d_array.push_back(matrix);
my_3d_string_array.push_back(string_matrix);
}
is there a stupid error i am making here?
Array types are not supported as the elements in containers.
The workaround is, probably, to use
std::array<>instead ofchar[]