Connecting Tech Pros Worldwide Help | Site Map

Constants and templates

max.giacometti@gmail.com
Guest
 
Posts: n/a
#1: Mar 23 '07
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

=?iso-8859-1?q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a
#2: Mar 23 '07

re: Constants and templates


On 23 Mar, 11:46, max.giacome...@gmail.com wrote:
Quote:
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

Rolf Magnus
Guest
 
Posts: n/a
#3: Mar 23 '07

re: Constants and templates


max.giacometti@gmail.com wrote:
Quote:
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;


Closed Thread