By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 817 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

template syntax.../ resent

P: n/a
Hi all,

I just hit the following definition in a c++ API:

template <class Str> template <class T, class B>
mysql_ColData<Str>::operator Null<T,B> () const {
if ((*this)[0] == 'N' && (*this)[1] == 'U' &&
(*this)[2] == 'U' && (*this)[3] == 'L' && (*this).size() == 4)
return Null<T,B>(null);
else return Null<T,B>(conv(T()));
}

Is the first line equivalent to
template <class Str, class T, class B> ?

Are both syntax compliant to c++ standards?

cheers

regard

phf
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
pa**************@noos.fr wrote:
Hi all,

I just hit the following definition in a c++ API:

template <class Str> template <class T, class B>
mysql_ColData<Str>::operator Null<T,B> () const {
if ((*this)[0] == 'N' && (*this)[1] == 'U' &&
(*this)[2] == 'U' && (*this)[3] == 'L' && (*this).size() == 4)
return Null<T,B>(null);
else return Null<T,B>(conv(T()));
}

Is the first line equivalent to
template <class Str, class T, class B> ?
No, the first is the beginning of the definition of a nested template: the outer
template, a class template mysql_ColData, has a single template parameter Str;
the inner template, a template conversion operator, has two template parameters
T and B.
Are both syntax compliant to c++ standards?
In different contexts, yes.
phf


Jonathan
Jul 23 '05 #2

P: n/a
Jonathan Turkanis wrote:

Thanks for your fast and precise answer...
phf
pa**************@noos.fr wrote:
Hi all,

I just hit the following definition in a c++ API:

template <class Str> template <class T, class B>
mysql_ColData<Str>::operator Null<T,B> () const {
if ((*this)[0] == 'N' && (*this)[1] == 'U' &&
(*this)[2] == 'U' && (*this)[3] == 'L' && (*this).size() == 4)
return Null<T,B>(null);
else return Null<T,B>(conv(T()));
}

Is the first line equivalent to
template <class Str, class T, class B> ?

No, the first is the beginning of the definition of a nested template: the outer
template, a class template mysql_ColData, has a single template parameter Str;
the inner template, a template conversion operator, has two template parameters
T and B.

Are both syntax compliant to c++ standards?

In different contexts, yes.

phf

Jonathan

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.