Re: Linked list problem
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Sat, 15 Oct 2005 13:28:51 -0500
On Sat, 15 Oct 2005 11:15:28 -0700, "Peter Schmitz"
<PeterSchmitz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>HI,
>
>I tried to do the following:
>
>struct TESTLIST {
> ULONG anynumber;
> CStringArray mystrings;
>};
>
>std::list<TESTLIST> mylinkedlist;
>
>
>Now, when I try to compile this, I receive the following error:
>
>c:\Programme\Microsoft Visual Studio .NET 2003\Vc7\include\list(34): error
>C2558: struct 'TESTLIST': no copy constructor available or copy constructor
>is declared 'explicit'....
>
>Can anyone help me out of this?
Standard containers require the types they store to be copy constructible.
Your problem is with CStringArray, which hasn't got an accessible copy ctor
and is preventing instantiation of the default copy ctor for TESTLIST. You
might be able to write a copy ctor for TESTLIST (BTW, all caps
conventionally names a macro) that uses CStringArray::Copy, or you might
simply use std::vector<CString> as a substitute for CStringArray.
--
Doug Harrison
Visual C++ MVP
.
- Prev by Date: Re: Getting Certified
- Next by Date: Re: Linked list problem
- Previous by thread: Re: Getting Certified
- Next by thread: Re: Linked list problem
- Index(es):
Relevant Pages
|