public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "learning c++" <learning_c@hotmail.com>
To: gcc-help@gcc.gnu.org
Subject: template-id does not match any template declaration
Date: Fri, 27 Aug 2004 09:16:00 -0000	[thread overview]
Message-ID: <BAY12-F21fgzBscdTfM00004a6c@hotmail.com> (raw)

Hi,
I am a novice for C++, and I compiled a program with C++ and there are an 
error, Pleaes help me.

Thanks,

#include <iostream>

template <class T>
class pair {
    T value1, value2;
  public:
    pair (T first, T second)
      {value1=first; value2=second;}
    T module () {return 0;}
};

template <>
class pair <int> {
    int value1, value2;
  public:
    pair (int first, int second)
      {value1=first; value2=second;}
    int module ();
};

template <>
int pair<int>::module() {
  return value1%value2;
}
int main () {
  pair <int> myints (100,75);
  pair <float> myfloats (100.0,75.0);
  std::cout << myints.module() << '\n';
  std::cout << myfloats.module() << '\n';
  return 0;
}

Error:
templatemodule1.cpp:22: error: template-id `module<>' for `int
   pair<int>::module()' does not match any template declaration
templatemodule1.cpp:22: error: syntax error before `{' token

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

             reply	other threads:[~2004-08-27  6:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-27  9:16 learning c++ [this message]
2004-08-27 12:11 ` Arno Wilhelm
2004-08-27 15:04 ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY12-F21fgzBscdTfM00004a6c@hotmail.com \
    --to=learning_c@hotmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).