Question

TauYoung on Tue, 21 Oct 2014 05:43:06


I created a C++/CLI console application with below code:

int main(array<System::String ^> ^args)
{
for (String^ str : args)
{
}
    return 0;
}

I got the compile error:

1>ConsoleApplication1.cpp(10): error C3312: no callable 'begin' function found for type 'cli::array<System::String ^,1> ^'
1>ConsoleApplication1.cpp(10): error C3312: no callable 'end' function found for type 'cli::array<System::String ^,1> ^'

It seems cli::array does not support range-base for statement.



Sponsored



Replies

Viorel_ on Tue, 21 Oct 2014 08:20:45


Currently you have to use this alternative form:

for each ( auto arg in args )
{
    . . . .
}