472,102 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

template syntax.../ resent

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
2 1184
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
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.

Similar topics

699 posts views Thread by mike420 | last post: by
2 posts views Thread by adrian.hawryluk | last post: by
2 posts views Thread by Gary Nastrasio | last post: by
9 posts views Thread by Adam Nielsen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.