Concepts and ADL

已查看 83 次
跳至第一个未读帖子

Vicente J. Botet Escriba

未读,
2015年11月27日 14:12:002015/11/27
收件人 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

未读,
2015年11月27日 19:41:082015/11/27
收件人 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.

回复全部
回复作者
转发
0 个新帖子