HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by loeg | Hacker News Reader
Parent
Full thread
loeg
·
The C version works with distinct types for a and b. Does this?
View on HN
Jyaif
·
That's not a feature, it's more bug prone.
andrepd
·
This one works too, if they are implicitly convertible (e.g. max(1, 2.0))
bstamour
·
No it won't. You'll get a compile time error, as T could either deduce to int or double. Unless you explicitly specify it as max<int>(1, 2.0) or max<double>(1, 2.0).
Reply on news.ycombinator.com