Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Concepts and member functions

From: Sebastian Gesemann (s.gesemann_at_[hidden])
Date: 2009-04-28 04:30:37


On Mon, Apr 27, 2009 at 9:42 PM, Mirko Stocker <me_at_[hidden]> wrote:
> It all started when I changed:
>
>  template <typename TestClass,typename MemFun>
> to
>  template <std::DefaultConstructible TestClass,std::CopyConstructible MemFun>
>
> and that lead to the following error:
>
> error: ‘((cute::incarnate_for_member_function<TestClass, MemFun>*)this)-
>>cute::incarnate_for_member_function<TestClass, MemFun>::memfun’ cannot be
> used as a member pointer, since it is of type ‘MemFun’
>
> So I thought I'd need to express that MemFun is a member pointer to TestClass,
> and that's where I'm stuck right now :) Or am I doing something
> unnecessary/unconvential/stupid here?

I don't think there's direct support of pointer to member types in the
concept system.

You could do something like this:

template<ClassType TestClass, Returnable R>
  requires DefaultConstructible<TestClass>
class foo {
  R (TestClass::*memfun)();
  ...
};

Cheers!
SG