variadic function template c++

Started by
4 comments, last by Jacob Jingle 12 years, 10 months ago
Am I doing this right?

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;
}


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
Advertisement
From what I've heard, MSVC doesn't support variadic templates yet, but they use macros to partially fake it.
I trust exceptions about as far as I can throw them.

From what I've heard, MSVC doesn't support variadic templates yet, but they use macros to partially fake it.

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. (j/k)


but they use macros to partially fake it.

Examples?

[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.

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. (j/k)


but they use macros to partially fake it.

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.

Beginner in Game Development?  Read here. And read here.

 

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 :)

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 :)

Yeah, looks like we will have to wait until Visual Studio vNext(ver. 11) 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.

This topic is closed to new replies.

Advertisement