Connecting Tech Pros Worldwide Help | Site Map

Constants and templates

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 23rd, 2007, 10:55 AM
max.giacometti@gmail.com
Guest
 
Posts: n/a
Default Constants and templates

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


  #2  
Old March 23rd, 2007, 11:05 AM
=?iso-8859-1?q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a
Default 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

  #3  
Old March 23rd, 2007, 11:15 AM
Rolf Magnus
Guest
 
Posts: n/a
Default 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;


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.