Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Templates with two params (http://www.velocityreviews.com/forums/t952810-templates-with-two-params.html)

ArbolOne 09-28-2012 08:37 PM

Templates with two params
 

template <class T, const int> class Data{
private:
T data;
int id;
public:
Data();
protected:
};
template <class T, const int>
Data<T, const int>::Data(){
//ctor
}

What am I doing wrong?

ArbolOne 09-28-2012 09:10 PM

Re: Templates with two params
 
On Friday, September 28, 2012 4:37:05 PM UTC-4, ArbolOne wrote:
> template <class T, const int> class Data{
>
> private:
>
> T data;
>
> int id;
>
> public:
>
> Data();
>
> protected:
>
> };
>
> template <class T, const int>
>
> Data<T, const int>::Data(){
>
> //ctor
>
> }
>
>
>
> What am I doing wrong?


GCC reports this error message:

.../data.cpp:6: error: type/value mismatch at argument 2 in template parameter list for 'template<class T, int <anonymous> > class jme::Data'
.../data.cpp:6: error: expected a constant of type 'int', got 'const int'

ArbolOne 09-28-2012 10:06 PM

Re: Templates with two params
 
Wow! You nailed it man, impressive, very impressive. Give yourself a pad on the shoulder, no, a few pads on the shoulder.


ArbolOne 09-28-2012 10:32 PM

Re: Templates with two params
 
On Friday, September 28, 2012 6:14:11 PM UTC-4, Paavo Helde wrote:
> ArbolOne <arbolone@gmail.com> wrote in
>
> news:6b3daf83-6cad-495d-9691-a48dbee1ca78@googlegroups.com:
>
>
>
> > Wow! You nailed it man, impressive, very impressive. Give yourself a

>
> > pad on the shoulder, no, a few pads on the shoulder.

>
>
>
> Hope these are not iPads ...


Well, I am writing this program in the hope to learn more about c++, specially templates. Is there anything I should know about templates and iPads?

red floyd 09-28-2012 11:25 PM

Re: Templates with two params
 
On 9/28/2012 3:32 PM, ArbolOne wrote:
> On Friday, September 28, 2012 6:14:11 PM UTC-4, Paavo Helde wrote:
>> ArbolOne <arbolone@gmail.com> wrote in
>>> pad on the shoulder, no, a few pads on the shoulder.

>> Hope these are not iPads ...

>
> Well, I am writing this program in the hope to learn more about c++, specially templates. Is there anything I should know about templates and iPads?
>

He was making a joke regarding "*pad* on the shoulder". Don't sweat
it. BTW, I think the iPad uses Objective-C, not C++.




All times are GMT. The time now is 01:09 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.