1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\list(1194): error C2451: conditional expression of type 'void' is illegal
1> Expressions of type void cannot be converted to other types
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\list(1188) : while compiling class template member function 'void std::list<_Ty>::remove(const _Ty &)'
1> with
1> [
1> _Ty=ServerLoginResponseCallback
1> ]
1> c:\users\shawn\edu\csclient\ConfigurationServerClient.h(56) : see reference to class template instantiation 'std::list<_Ty>' being compiled
1> with
1> [
1> _Ty=ServerLoginResponseCallback
1> ]
here is the code that generates the error…
typedef std::shared_ptr<protocols::ServerLoginResponse> ServerLoginResponsePtr;
typedef std::function<void (ServerLoginResponsePtr)> ServerLoginResponseCallback;
typedef std::list<ServerLoginResponseCallback> ServerLoginResponseCallbackList;
So we have a list of functors that return void and take an argument of type shared_ptr. Does anyone know why the MSVC compiler is having trouble?
It seems you have problems with instantiation. I’ve just tried to reproduce your bug but my MSVC compiled this code successfully.
Please, show us more code )) For example, show us how you use this list after creation.