Sign in to follow this  
Jacob Jingle

variadic function template c++

Recommended Posts

Am I doing this right?

[code]class A
{
public:
void func(bool a, int b) {}
};

template<class policy=A>
class B : public policy
{
public:
template<typename ... ARGS>
void loader(int val, ARGS&& ... args)
{
policy::func(args);
}
};

int _tmain(int argc, _TCHAR* argv[])
{
B<A> c;
c.loader<bool, int>(false, 0);
return 0;
}[/code]

Does MSVC(version 10 + sp1) support variadic function templates?
If not, what's another good way to do something like this?

Thx ahead of time,
Jacob Jingle

Share this post


Link to post
Share on other sites
[quote name='Storyyeller' timestamp='1306848228' post='4817869']
From what I've heard, MSVC doesn't support variadic templates yet, but they use macros to partially fake it.[/quote]
Damn, if only Microsoft wasn't a small company with a small staff and if only it had the money to keep up with the fast pace of the c++ committee...

...But its not, and it can't afford to put in place holder code and company specific extensions only to have the standard change in the future. Nope, no way in hell. The only thing it can do, with its limited budget and small staff, is just to wait until the final draft is available. These mom and pop ventures just can't compete with big monopolies. ([i]j[/i]/[i]k)[/i]

[quote name='Storyyeller' timestamp='1306848228' post='4817869']
but they use macros to partially fake it.
[/quote]
Examples?

Share this post


Link to post
Share on other sites
[quote name='Jacob Jingle' timestamp='1306883981' post='4818077']
[quote name='Storyyeller' timestamp='1306848228' post='4817869']
From what I've heard, MSVC doesn't support variadic templates yet, but they use macros to partially fake it.[/quote]
Damn, if only Microsoft wasn't a small company with a small staff and if only it had the money to keep up with the fast pace of the c++ committee...

...But its not, and it can't afford to put in place holder code and company specific extensions only to have the standard change in the future. Nope, no way in hell. The only thing it can do, with its limited budget and small staff, is just to wait until the final draft is available. These mom and pop ventures just can't compete with big monopolies. ([i]j[/i]/[i]k)[/i]

[quote name='Storyyeller' timestamp='1306848228' post='4817869']
but they use macros to partially fake it.
[/quote]
Examples?
[/quote]
You do realize that creating the parser for C++ regardless of the company is no by means trivial. It took 10 years to get a standards-compliant compiler. Plus the C++0x standard, FWIR, is still not officially standardized yet. You my friend are barking up the wrong tree. However, you could try GCC's C++ compiler and see if you have better luck with that.

Edit: Ok. I just saw your "j/k" at the end of your post. Feel free to ignore the above.

Share this post


Link to post
Share on other sites
There was a video from one of Microsoft's lead VSC++ developers about this. They were desperate to include varadic templates in 10, but crunch happened and it had to be postponed till next release.

The standard library implementors were also clamouring for it but it just couldn't happen.

They ended up having to base priorities on overall demand, and lambdas and r-value references won. It will be sorted for the next release apparently. At least we got auto :)

Share this post


Link to post
Share on other sites
[quote name='Aardvajk' timestamp='1306949990' post='4818357']
There was a video from one of Microsoft's lead VSC++ developers about this. They were desperate to include varadic templates in 10, but crunch happened and it had to be postponed till next release.

The standard library implementors were also clamouring for it but it just couldn't happen.

They ended up having to base priorities on overall demand, and lambdas and r-value references won. It will be sorted for the next release apparently. At least we got auto :)
[/quote]
Yeah, looks like we will have to wait until [i]Visual Studio vNext(ver. 11)[/i] comes out in the beginning of next year....If they make their deadline and if they're able to include it in that deadline. :(

I wish they updated more frequently.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this