C++11 introduced a new syntax for function declaration,
auto func(T rhs, U lhs) -> V
This was to solve some problems that appeared in the old C++ standard with function templates. Read this short Wikipedia article section for details about the problem:
> http://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax
My question is, does D confront with the same problem? If so, how does it fix it (if at all)?
DSolve can solve ordinary differential equations (ODEs), partial differential equations (PDEs), differential algebraic equations (DAEs), delay differential equations (DDEs), integral equations, integro-differential equations, and hybrid differential equations.
Differential equations are solved in Python with the Scipy. integrate package using function odeint or solve_ivp. t: Time points at which the solution should be reported. Additional internal points are often calculated to maintain accuracy of the solution but are not reported.
In D, the compiler can deduce the return type for you. So there's no need to have the -> V
syntax.
auto func(T, U)(T lhs, U rhs) { return lhs + rhs; }
or if you want to be more specific (but it's better to let the compiler figure out the type with auto
!)
typeof(T.init + U.init) func(T, U)(T lhs, U rhs) { return lhs + rhs; }
Like C++, you cannot use typeof(lhs + rhs)
in that place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With