Someone posted a message about this on Dec. 10 2004.

Please compare Example 2 to Examples 8 and 9.
Also, is Example 6 doing the right thing.

Pass == no compile errors
Fail == compile errors.

Thanks
David

// -------------------------------------------
// problems here

template<class S>
class Orange {

  template<class T> void peal(T& x);
  template<class T> void squeeze();

  template<class T> struct Peach;
};

// Ex. 1
// Pass
template<class S> template<class T>
struct Orange<S>::Peach {
};

// Ex. 2
// Pass
// compare this to Ex. 8 and Ex. 9 below
template<> template<class T>
struct Orange<int>::Peach {
};

// Ex. 3
// Pass
template<> template<>
struct Orange<int>::Peach<double>{
};

// Ex. 4
// Fail
template<class T> template<>
struct Orange<T>::Peach<double>{
};

// Ex. 5
// Pass
template<class S> template<class T>
void Orange<S>::peal(T& x) {
}

// Ex. 6
// Fail
// This does not work (found a reference at IBM:)
template<class S> template<>
void Orange<S>::peal<double>() {
}

// Ex. 7
// Pass
template<> template<>
void Orange<int>::peal<int>(int& x) {
}

// Ex. 8
// Pass
// This works but Ex. 9 fails.
template<> template<class T>
void Orange<int>::peal(T& x) {
}

// Ex. 9
// Fail
template<> template<class T>
void Orange<int>::squeeze() {
}
// -------------------------------------------


int main() {
  return 0;
}

-- 
# Department of Applied Physics and Applied Mathematics
# Columbia University


_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to