From: Alexandre Oliva <oliva@dcc.unicamp.br>
To: rssh@grad.kiev.ua
Cc: egcs@cygnus.com
Subject: Re: [Q] about template specialization
Date: Mon, 27 Apr 1998 00:33:00 -0000 [thread overview]
Message-ID: <orlnsrvlnc.fsf@garnize.lsd.dcc.unicamp.br> (raw)
In-Reply-To: <354231E5.F2165C14@Shevchenko.Kiev.UA>
Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA> writes:
> template<class K, class E> inline
> const K& default_key(const E&);
> template<class T> inline
> const T& default_key(const T& x)
> virtual const K& get_key(const E& x)
> { return default_key<K,E>(x); }
> I think that X<Y,Y>::get_key must call specialization (i. e. second
> definition)
There's not such thing as partial specialization of a function
templates. You have just overloaded `default_key' with two different
template functions. In this case, you will always have to explicitly
specify template arguments. Since you specify default_key<K,E>, not
just default_key<K>, you are selecting the first definition.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
next prev parent reply other threads:[~1998-04-27 0:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-25 11:59 Ruslan Shevchenko
1998-04-27 0:33 ` Alexandre Oliva [this message]
[not found] ` <orlnsrvlnc.fsf.cygnus.egcs@garnize.lsd.dcc.unicamp.br>
1998-04-27 17:27 ` Nathan Myers
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=orlnsrvlnc.fsf@garnize.lsd.dcc.unicamp.br \
--to=oliva@dcc.unicamp.br \
--cc=egcs@cygnus.com \
--cc=rssh@grad.kiev.ua \
/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).