On Monday, 7 March 2016 at 18:17:18 UTC, Ola Fosheim Grøstad wrote:
On Monday, 7 March 2016 at 16:30:48 UTC, Namespace wrote:
Thanks to the wildcard modifier inout. Is there any possible way to do the same in C++?

In this specific case you could do it with a macro if you don't mind dirty macros, but you really should implement the const version explicitly or use a free function that cover both cases using templating.

If you are looking for information on C++ you probably should use stack overflow:

http://stackoverflow.com/questions/7792052/c-template-to-cover-const-and-non-const-method

Honestly speaking, I think this case is impossible to solve in C++. I'll show my fellow students the advantages of D over C++ in next couple of weeks, and this example is pretty good. :)

Reply via email to