Templates with two params

Discussion in 'C++' started by ArbolOne, Sep 28, 2012.

  1. ArbolOne

    ArbolOne Guest

    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, Sep 28, 2012
    #1
    1. Advertising

  2. ArbolOne

    ArbolOne Guest

    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, Sep 28, 2012
    #2
    1. Advertising

  3. ArbolOne

    ArbolOne Guest

    Wow! You nailed it man, impressive, very impressive. Give yourself a pad on the shoulder, no, a few pads on the shoulder.
     
    ArbolOne, Sep 28, 2012
    #3
  4. ArbolOne

    ArbolOne Guest

    On Friday, September 28, 2012 6:14:11 PM UTC-4, Paavo Helde wrote:
    > ArbolOne <> wrote in
    >
    > news::
    >
    >
    >
    > > 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?
     
    ArbolOne, Sep 28, 2012
    #4
  5. ArbolOne

    red floyd Guest

    On 9/28/2012 3:32 PM, ArbolOne wrote:
    > On Friday, September 28, 2012 6:14:11 PM UTC-4, Paavo Helde wrote:
    >> ArbolOne <> 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++.
     
    red floyd, Sep 29, 2012
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Padgett
    Replies:
    0
    Views:
    470
    Padgett
    Jul 4, 2003
  2. JKop
    Replies:
    3
    Views:
    519
  3. recover
    Replies:
    2
    Views:
    855
    recover
    Jul 25, 2006
  4. A L
    Replies:
    1
    Views:
    529
    Alf P. Steinbach /Usenet
    Aug 25, 2010
  5. Barry
    Replies:
    9
    Views:
    483
    Ara.T.Howard
    Sep 15, 2005
Loading...

Share This Page