pearinthemountains
pearinthemountains

Reputation: 135

error C2440 and functors

maybe you would know, I get an error:

 error C2440: 'initializing' : cannot convert from 'int' 
              Conversion from integral type to pointer type requires reinterpret_cast

It goes to ' file in MS VS 2010 folder:

template<class _Other1,
        class _Other2>
        _Pair_base(_Other1&& _Val1, _Other2&& _Val2)
        : first(_STD forward<_Other1>(_Val1)),
            second(_STD forward<_Other2>(_Val2))
        {   // construct from moved values
        }

I was looking for different solutions but could not find a correct one.

Upvotes: 0

Views: 177

Answers (1)

doctorlove
doctorlove

Reputation: 19317

The error says

'initializing' : cannot convert from 'int' to 'EnterFunctor *'

The only part of your code you share is

functors.push_back(make_pair(sessionStartFunc, 
    pair<EnterFunctor*, ExitFunctor*>(NULL,sessionStartExit)));

If NULL is #defined as 0 this gives you an int but you promised a pair of pointers, so as the next line of the error says you can use a cast to make NULL the right type of pointer.

Upvotes: 1

Related Questions