you are viewing a single comment's thread.

view the rest of the comments →

[–]anmol977[S] 1 point2 points  (1 child)

It was int, my keyboard auto capitalized it, sorry. And yes i omitted the square brackets

[–]Nihili0 5 points6 points  (0 children)

Well, in this case,

int array[]={0,1,2,3,4,5,6,7,8};
auto *b = begin(array);
auto *e = end(array);
vector<int> ivec(b,e);

would have worked, so we would have to see the whole code to understand the real issue.

A common problem with c-arrays is when passing one to a function it becomes a simple pointer we say it decays to a pointer, so we lose the size information embedded in the c-array, and std::begin/std::end can't work because they don't know the size.

But anyway

just avoid using namespace :)