Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Importing names from concept

From: Stefan Chrobot (jan_ek_at_[hidden])
Date: 2007-04-23 04:49:29


Hello!

Is there a way to import names from a concept into a scope that is
neither a concept refinement nor a constrained template?

concept MyC<typename T>
{
     void function(T);
}

struct A
{
    // ...
};

concept_map MyC<A>
{
     void function(A)
     {
         // ...
     }
}

int main()
{
     A a;
     // use A as defined by MyC
     // maybe something like:
     // using MyC<A>;
     function(a); // error
}

The reason I'm asking is that concepts in a way define static interfaces
  and sometimes one wants to use the object as defined in the concept -
for example for testing purposes - I'm using the TUT framework, which is
itself templatized (so I'm not sure there is a way to make a constrained
template test) and if I want to check for concept mapping I have to use
the explicit syntax:
     MyC<A>::function(a);
I understand that such import of names may cause ambiguity which should
not really happen and something should be preferred (name from the
concept?), but was this issue ever considered? Do you think there might
be other pros?

Stefan Chrobot