By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,147 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,147 IT Pros & Developers. It's quick & easy.

Constants and templates

P: n/a
Hi everybody!!!

I have a problem with templates and constants.

I have a template class

template<const int a, const int bclass...

Inside this class I have to use another template class, whose
parameter is function (the sum) of a and b.

How can I do that?
Thanks,

Massimiliano

Mar 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 23 Mar, 11:46, max.giacome...@gmail.com wrote:
Hi everybody!!!

I have a problem with templates and constants.

I have a template class

template<const int a, const int bclass...

Inside this class I have to use another template class, whose
parameter is function (the sum) of a and b.

How can I do that?
You mean something like this?

template<int C>
class Foo
{
int i[C];
};
template<int A, int B>
class Bar
{
Foo<A+Bf;
};

int main()
{
Bar<1,2b;
}

--
Erik Wikström

Mar 23 '07 #2

P: n/a
ma************@gmail.com wrote:
Hi everybody!!!

I have a problem with templates and constants.

I have a template class

template<const int a, const int bclass...

Inside this class I have to use another template class, whose
parameter is function (the sum) of a and b.

How can I do that?
otherclass<a+bmyobject;
Mar 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.