template syntax...

U

user

Hi all,

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

template <class Str> template <class T, class B>
mysql_ColData<Str>::eek:perator 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
 
V

Victor Bazarov

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

template <class Str> template <class T, class B>
mysql_ColData<Str>::eek:perator 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, most certainly not.
Are both syntax compliant to c++ standards?

What do you mean by "both"? It very much depends on your declaration of
'mysql_ColData' and its member 'operator Null'. I mean, if you just ask
whether it's OK (call it compliant, standard, valid, legal, or whatever)
to write

template <class Str, class T, class B>

then how can anybody tell you if you don't supply the context?

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,654
Latest member
LannySinge

Latest Threads

Top