john coltrane
12/17/2008 10:52:00 PM
On Dec 17, 4:59 pm, Andrey Tarasevich <andreytarasev...@hotmail.com>
wrote:
> Coltrane wrote:
> > I am trying to compile some code from the "C++ Programming Language
> > Special Edition" book and I am getting compiler errors with Visual C+
> > +
> > and g++. The sample code is in appendix C, section C.13.
>
> > The code is as follows:
>
> > template<class T>
> > class X{
> > static T def_val;
> > static T* new_X(T a = def_val);
>
> > };
>
> > template<class T> T X<T>::def_val(0,0);
> > template<class T> T* X<T>::new_X(T a) {}
>
> > template<> int X<int>::def_val<int> = 0; /*line 10 */
> > template<> int* X<int>::new_X<int>(int i){} /* line 11 */
> > ...
> > can someone tell me what the problem is.
> > Is this a problem with the compiler or am I just messed up in the
> > head
> > (very possible)
>
> It is not supposed to have those second <int>'s in the specialized
> definitions
>
> template<> int X<int>::def_val = 0; /*line 10 */
> template<> int* X<int>::new_X(int i) {} /* line 11 */
>
> --
> Best regards,
> Andrey Tarasevich- Hide quoted text -
>
> - Show quoted text -
thanks