Topic: explicit specialization without template<>?
Author: "Joerg Schaible" <Joerg.Schaible.A@T.gft.de>
Date: 1999/05/21 Raw View
Hi,
>But I have seen the code like
>class foo<int> {...}; //without template<>
>And at least two compilers accept it. Is this latter one really well-
>formed?
This is the former syntax to define a specialization. Many compilers still
support it (or did not support the new syntax until now).
Greetings, J rg
--
BTW: It is normally better to answer to the group! For direct mail reply
exchange the ".A@T." by "@"
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James.Kanze@dresdner-bank.com
Date: 1999/05/20 Raw View
In article <7hqd5c$ak8$1@nnrp1.deja.com>,
Zhigang XU <xu_zhigang@my-dejanews.com> wrote:
> The standard states that an explicit specialization of a template
class
> can be declared with template<>. Such as
> template <class T> class foo;
> template<> class foo<int> {...}; //with template<>
>
> But I have seen the code like
> class foo<int> {...}; //without template<>
>
> And at least two compilers accept it. Is this latter one really well-
> formed?
Not according to the standard. It was, however, according to the ARM,
CFront accepted it, and many compilers probably do as well, for reasons
of backward compatibility. This is a relatively late change in the
standard.
--
James Kanze mailto:
James.Kanze@dresdner-bank.com
Conseils en informatique orientie objet/
Beratung in objekt orientierter
Datenverarbeitung
Ziegelh|ttenweg 17a, 60598 Frankfurt, Germany Tel. +49 (069) 63 19 86
27
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Zhigang XU <xu_zhigang@my-dejanews.com>
Date: 1999/05/18 Raw View
The standard states that an explicit specialization of a template class
can be declared with template<>. Such as
template <class T> class foo;
template<> class foo<int> {...}; //with template<>
But I have seen the code like
class foo<int> {...}; //without template<>
And at least two compilers accept it. Is this latter one really well-
formed?
I actually saw the code in the CD2:
18.2.1 numeric limits [lib.limits]
...
namespace std {
template<class T> class numeric_limits;
enum float_round_style;
class numeric_limits<bool>;
class numeric_limits<char>;
...
}
What troubles me is that I can not find any statement in CD2 that
explicitly supports this sort of template specialization declaration.
Of course, it is possible that I overlooked the right place.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]