Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Concepts and member functions

From: Mirko Stocker (me_at_[hidden])
Date: 2009-04-27 15:42:29


On Monday 27 April 2009 20:56:43 you wrote:
> Do you mean something like this?
>
> concept C1<typename T> { ... }
> concept C2<typename T> { ... }
> concept C1andC2<typename First, typename Second> { ... }
>
> template <C1 C1_type, C2 C2_type>
> requires C1and2<C1_type, C2_type>
> struct C1_and_C2_have_relationship {
> };

I guess it could lead to this, yes.

> I'm not sure what you want from the "relationship" but, in my
> experience, when two types are involved in a requirement clause or
> concept, they are usually involved in a SameType or Convertibility
> constraint on associated types.

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?
  (To maybe make motivation clearer: I'm writing an article for a seminar at
our university on concepts and refactoring. It's simply an introduction, and I
also want to have a few sections on my experiences when converting an existing
codebase to concepts..)

Thanks!

Mirko