Topic: cv-qualifer & pointer-to-member-function
Author: cardboard.mti.sgi.com!sgi.sgi.com!uu4.psi.com!shellgate!jjpersch (Jeff J. Persch)
Date: 1996/04/30 Raw View
I've got a question about cv-qualifiers & pointers-to-member-functions.
Note that this is not a question about templates, even though I use
template syntax for clarity.
template<class T> class F {
typedef T object_type;
typedef void (object_type::* pointer_to_member_function)();
typedef void (object_type::* pointer_to_const_member_function)() const;
typedef void (* pointer_to_function_of_object)(object_type*);
typedef void (* pointer_to_function_of_const_object)(object_type const*);
};
What is the type of F<T const>::pointer_to_member_function?
void (T::*)() -or- void (T::*)() const
This is a leading question, since if it is the former, it is contrary
to the case for non-member functions, where:
void (*)(T const*)
equivalent to
F<T>::pointer_to_function_of_const_object
equivalent to
F<T const>::pointer_to_function_of_object
equivalent to (7.1.5.2 redundant cv-qualifers)
F<T const>::pointer_to_function_of_const_object
I believe the cv-qualifer should propagate into pointer to member function
decls the same way, such that:
void (T::*)() const
equivalent to
F<T>::pointer_to_const_member_function
equivalent to
F<T const>::pointer_to_member_function
equivalent to (7.1.5.2 redundant cv-qualifers)
F<T const>::pointer_to_const_member_function
Unfortunately, the current crop of compilers disagree, and my reading of
chapters 7 & 9 of the April '95 DWP left me slightly woozy.
--
Jeffrey J. Persch
jjpersch@shellus.com
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]