C++ Overload resolution Categorization of argument to parameter cost


Overload resolution partitions the cost of passing an argument to a parameter into one of four different categorizes, called "sequences". Each sequence may include zero, one or several conversions

  • Standard conversion sequence

    void f(int a); f(42);
  • User defined conversion sequence

    void f(std::string s); f("hello");
  • Ellipsis conversion sequence

    void f(...); f(42);
  • List initialization sequence

    void f(std::vector<int> v); f({1, 2, 3});

The general principle is that Standard conversion sequences are the cheapest, followed by user defined conversion sequences, followed by ellipsis conversion sequences.

A special case is the list initialization sequence, which does not constitute a conversion (an initializer list is not an expression with a type). Its cost is determined by defining it to be equivalent to one of the other three conversion sequences, depending on the parameter type and form of initializer list.