Template functions, can we make it more simple?

F i L witte2008 at gmail.com
Sat Aug 3 01:59:40 PDT 2013


monarch_dodra wrote:
> Regardless of the existing merits, that would be a (massive) 
> breaking change, and as mentioned, it brings nothing we 
> couldn't do before...

Sure, but not if you do it like my second example:

    auto func(auto a, auto b) // like C++14

That doesn't break anything, right?


> Anytime I write the body of a function that doesn't use one of 
> its args, I keep the  arg name empty. This implicitly documents 
> that the arg is unused. Many people do this in C++ too, since 
> msvc will flag you for not doing it anyways. So your answer 
> your question: "who's hand-writing a bunch of functions with  
> nameless params in real D code": Lot's of people, including in 
> Phobos.

Fair enough. However, using 'auto' like above would allow cleaner 
syntax without getting in your way I think.



More information about the Digitalmars-d mailing list