Template type deduction in C++ for Class vs Function?

后端 未结 4 2044
难免孤独
难免孤独 2020-12-03 01:37

Why is that automatic type deduction is possible only for functions and not for Classes?

4条回答
  •  有刺的猬
    2020-12-03 02:29

    I think implicit type conversion is only applicable to function arguments only so compiler can deduce it to make the function call success.

    But how can it deduce what type you wanna have it class.

    We have to wait 4 such a day when we have AI based compiler to do read our minds.

提交回复
热议问题