11
votes

As far as I know, there are two propsals for uniform call syntax for C++17 (where the other one is called unified call syntax).

Reading them, I cant see how they intend to handle namespaces.

Example:

class Class {...}
namespace MyNamespace {
  void f(Class x, Class y);
}

Will it be possible to call this method using something like:

Class a, b;
a.MyNamespace::f(b);

Or do both the free function, and the class need to be defined in the same namespace?

References:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4174.pdf

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4165.pdf

1
As a personal note, i'd find it really neat if something like this, which enables chaining of function calls, where added to the C++ standard. Utilizing the pipe operator, as boost range and Eric Nieblers range v3 is just complicated (plus is has the disadvantage of having lover priority than operator==)Viktor Sehr
Current EWG direction is to allow f(x, y) to call x.f(y) if ordinary lookup fails to find a viable f, and not the reverse. I don't think there's a paper nailing down all the details yet, but I'd be surprised if they want to touch qualified calls.T.C.
Seems it didnt make it, and yes I'd be surprised to, but verry happy!Viktor Sehr

1 Answers

3
votes

Update: C++17 does not get unified call syntax at this time. Motion does not pass. #cpp #cpp17

https://twitter.com/ericniebler/status/705855444049399808