Why can I prevent implicit conversions for primitives but not user-defined types?

前端 未结 3 1655
轮回少年
轮回少年 2021-01-25 18:16

The High Integrity C++ Standards suggest that rvalue arguments to functions can be deleted thus preventing implicit conversions.

http://www.codingstandard.com/rule/8-3-4

3条回答
  •  无人及你
    2021-01-25 18:54

    There are 3 possible overloads

    • 1 is viable.
    • 2 is viable
    • 3 isn't

    2 is better match (template (non exact match) vs regular method (with one user define conversion)).

    You may look at http://en.cppreference.com/w/cpp/language/overload_resolution to see a complete set of rules needed

提交回复
热议问题