|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-01-12 00:46:31
Is this well-formed:
struct X {
typedef void func_t(int);
func_t member;
};
void X::member(int) {
return;
}
What about:
struct X {
typedef void func_t(int) const;
// ^^^^^
func_t member;
};
void X::member(int) const {
return;
}
This is the root of my question:
template<class> struct test;
template<class R, class C> struct test<R C::*> {
typedef R type;
};
struct X { };
test< void (X::*)(int) >::type // what type is this?
Is it a function type, or is it a "member function type"?
The reason I ask is I'm trying to make a 'is_ptr_to_mem_fun' traits class
without massive specialization. This works on Comeau C++:
template<class T> struct is_ptr_to_mem_fun {
enum { value = false };
};
template<class R, class C> struct is_ptr_to_mem_fun<R C::*> {
private:
template<class U> static char check(U (*)[1]);
template<class U> static char (& check(...))[2];
public:
enum { value = sizeof(check<R>(0)) != 1 };
};
struct X { };
int main() {
std::cout
<< is_ptr_to_mem_fun< int X::* >::value << ' '
<< is_ptr_to_mem_fun< int (X::*)(void) >::value << &std::endl;
return 0;
}
???
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk