I tried the new class wxMessageQueue for inter thread communication that will be available in the next wxWidgets release. Since it is a template it can be used to send arbitrary user data. I tried it with std::string and it works fine, however it doesn't work with std::string array.
I wonder if I do something wrong or it can be used with arrays.
Basically, the message type is std::queue<T>.
I have defined it like this:
Code: Select all
typedef string myStr[4];
wxMessageQueue<myStr[4]> MyQueue;
Code: Select all
string msg[4]={str1,str2,str3,str4};
MyQueue.Post( msg);
Code: Select all
1) : error C2664: 'wxMessageQueue<T>::Post' : cannot convert parameter 1 from 'std::string [4]' to 'const std::basic_string<_Elem,_Traits,_Ax> (&)[4]'
1> with
1> [
1> T=myStr [4]
1> ]
1> and
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> Reason: cannot convert from 'std::string [4]' to 'const std::basic_string<_Elem,_Traits,_Ax> [4]'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> There is no context in which this conversion is possible
TIA, Marcus