Marco Benincà - 2019-02-12

Dear all
in the code below the call fun1(0) is resolved to the function

fun1(Test* t)

insted of

fun1(boost::any value)

it looks like the compiler prefers to cast 0 to Test* instead of boost::any

``
class Test
{
public:
int number;

Test() : number(0) {}

};

void fun1(boost::any value)
{
std::cout << "sono in void funzione1(boost::any value)!" << "\n";
}

void fun1(Test* t)
{
std::cout << "sono in void funzione1(Test
t)!\n";
}

int main()
{
int i = 1;
fun1(i);
i = 0;
fun1(0);
//fun1((boost::any(false)));
}
``

The call fun1((boost::any(false))) calls the rigth function of course

Marco

 

Last edit: Marco Benincà 2019-02-12