Prev: Assignment operator definition required in case of reference data member why?
Next: Assignment operator definition required in case of reference data member why?
From: Paul Bibbings on 14 May 2010 01:01 In [temp.arg.nontype]/3 (which is, admittedly, a non-normative note) it says: "...names or addressess of non-static class members are not acceptable template-arguments." and then goes on the give some example code in relation to various attempted instantiations of: template<int* p> class X { }; I'm a little confused here because, as it reads to me, the first part quoted above appears to be exhaustively prohibitive without reference to context whilst the example is, in turn, limited to a context in which providing an address of a non-static class member as a template argument fails primarily because it does not match the corresponding parameter. As far as I understand it, the following would be OK: struct X { int m; }; template<int X:*Xmemb> struct Y { }; int main() { Y<&X::m> y; // address of non-static class member used as // template-argument } which seems to suggest that the assertion that "names or addresses of non-static class members are not acceptable template-arguments" is overly general and that the example, as given, is merely attempting to effect an illustration whilst providing an inappropriate context. As there are no changes to this subclause in the FCD (n3092) I have to suppose that I am misunderstanding some detail of the wording, but at the moment I am unable to discover where this is occuring. Regards Paul Bibbings -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |