2004年4月22日木曜日

俺へぇ




# In a template definition, unqualified names will no longer find members of a dependent base. For example,

template <typename T> struct B {
int m;
int n;
int f ();
int g ();
};
int n;
int g ();
template <typename T> struct C : B<T> {
void g ()
{
m = 0; // error
f (); // error
n = 0; // ::n is modified
g (); // ::g is called
}
};

You must make the names dependent by prefixing them with this->. Here is the corrected definition of C<T>::g,

template <typename T> void C<T>::g ()
{
this->m = 0;
this->f ();
this->n = 0
this->g ();
}






0 件のコメント:

コメントを投稿