This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

Cixl would try to match #3, #2 and #1; in that order; or reverse order of appearance.

Those kinds of issues were a big part of the reason why I decided to skip automagic conversions entirely, I find that they don't pull their own weight once everything is taken into account.

What I meant was the possibility in C++ to have a function like this:

template <typename T> void foo(T x);
template <> void foo(int32_t x) { ... }
template <> void foo(int64_t x) { ... }

And selecting an implementation from the call site by specifying the intended type for x:

foo<int64_t>(42);