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

  • Thread starter Thread starter Marco Segurini
  • Start date Start date
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.
 
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
 
Back
Top