[ConceptGCC] |
ConceptGCC :Re: Concepts and member functions |
From: Mirko Stocker (me_at_[hidden])
Date: 2009-04-28 08:17:54
On Tuesday 28 April 2009 10:30:37 Sebastian Gesemann wrote:
> I don't think there's direct support of pointer to member types in the
> concept system.
Ok, so it's not my fault :)
>
> You could do something like this:
>
> template<ClassType TestClass, Returnable R>
> requires DefaultConstructible<TestClass>
> class foo {
> R (TestClass::*memfun)();
> ...
> };
Or I could wrap it all in a boost::function like this so I can use the memfun
on an instance of TestClass:
TestClass t;
boost::function<void (TestClass*)> f(memfun);
f(&t);
But I'm not sure if that really adds something of value.. except the concept
to express that TestClass must be DefaultConstructible.
Anyway, thanks for your help!
Mirko