[C++-CLI] Function with variable parameters list

M

Marco Segurini

Hi,

this code is from "C++/CLI Language Specification Working Draft 1.7,
Sep, 2004"

//---
void F(... array<int>^ args)
{
Console::WriteLine("# of arguments: {0}", args->Length);
for (int i = 0; i < args->Length; i++)
Console::WriteLine("\targs[{0}] = {1}", i, args);
}
int main()
{
F();
F(1); 10
F(1, 2);
F(1, 2, 3);
F(gcnew array<int> {1, 2, 3, 4});
}
//---


I like to know if the C++ compiler of VS2005 beta 1 supports this example.

TIA.
Marco.
 
T

Tomas Restrepo \(MVP\)

Hi Marco,
this code is from "C++/CLI Language Specification Working Draft 1.7,
Sep, 2004"

//---
void F(... array<int>^ args)
{
Console::WriteLine("# of arguments: {0}", args->Length);
for (int i = 0; i < args->Length; i++)
Console::WriteLine("\targs[{0}] = {1}", i, args);
}
int main()
{
F();
F(1); 10
F(1, 2);
F(1, 2, 3);
F(gcnew array<int> {1, 2, 3, 4});
}
//---


I like to know if the C++ compiler of VS2005 beta 1 supports this example.


Not the one on beta 1, but the compiler tools update does. You can get it
(and install it over the beta 1 command line tools so that you can use them
with the IDE) from here:
http://www.microsoft.com/downloads/...f1-9d16-439a-9a5e-e13eb0341923&displaylang=en
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top