▲ | maleldil 7 months ago | |
C++ has extensive type inference now (C++20):
`int` is required as a return type from `main`, but everything else is inferred. This works because `func` becomes a template function where each parameter type is a separate template type, so you get compile-time duck typing. It also works with concepts (e.g. `std::integral auto x`).It's quite neat, but I don't think anyone actually writes code this way, except for lambdas. |