Concepts and ADL

83 views
Skip to first unread message

Vicente J. Botet Escriba

unread,
Nov 27, 2015, 2:12:00 PM11/27/15
to std-pr...@isocpp.org
Hi,

I was looking on the Concept proposal for the impact of concepts and
ADL. I have not reached to identify it.

I was wondering if the namespace on which a concept is defined is
included in the associated set of namespaces that it will added to the
lookup.

E.g.

namespace CNS {

concept bool C ....;

void f(C& c);
};

If type T is a model of concept C, would the following be well formed?

T a;
f(a);


Any pointer is welcome.

Vicente

Nicol Bolas

unread,
Nov 27, 2015, 7:41:08 PM11/27/15
to ISO C++ Standard - Future Proposals


On Friday, November 27, 2015 at 2:12:00 PM UTC-5, Vicente J. Botet Escriba wrote:

namespace CNS {

     concept bool C ....;

     void f(C& c);
};

If type T is a model of concept C, would the following be well formed?

T a;
f(a);

You seem to be asking if concepts allow ADL if a type fulfilled the concept.

Remember, these declarations are declared to be equivalent (per 14.10.2):

void f(C &c);

template<typename T> requires C<T> //Needs () if `C` is a function
void f(T &c);

These declare the same function. Indeed, 14.10.2 goes on to express a highly complex set of rules to explain exactly how this breaks down.

But in any case, applying a requires clause to a function does not affect how it is looked up.

Reply all
Reply to author
Forward
0 new messages