This is approximately what I have: a class with a member var. that is a list of arrays. Member function addMsg should just appen a new message (which is an array of fixed length), but the compiler returns error, and since I am very new with all this stuff, I don't understand why. Can someone please help? The error I get is at the end.
Expand|Select|Wrap|Line Numbers
- typedef char MsgBuffer_T[1024];
- typedef std::list<MsgBuffer_T> msgList_T;
- class CMsgList{
- private:
- msgList_T msgList;
- public:
- BOOL addMsg(MsgBuffer_T* pMsg);
- }
- BOOL addMsg(MsgBuffer_T* pMsg){
- msgList.push_back(*pMsg);
- return TRUE;
- }
:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(34): error: a new-initializer may not be specified for an array
{new ((void _FARQ *)_P) _T1(_V); }
^
detected during:
instantiation of "void std::_Construct(_T1 *, const _T2 &) [with _T1=MsgBuffer_T, _T2=char [1024]]" at line 66
instantiation of "void std::allocator<_Ty>::construct(std::allocator<_Ty> ::pointer, const _Ty &) [with _Ty=MsgBuffer_T]" at line 222 of "C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list"
instantiation of "std::list<_Ty, _A>::iterator std::list<_Ty, _A>::insert(std::list<_Ty, _A>::iterator, const _Ty &) [with _Ty=MsgBuffer_T, _A=std::allocator<MsgBuffer_T>]" at line 208 of "C:\Program Files\Microsoft Visual Studio\VC98\IN
CLUDE\list"
instantiation of "void std::list<_Ty, _A>::push_back(const _Ty &) [with _Ty=MsgBuffer_T, _A=std::allocator<MsgBuffer_T>]"
c