CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    97

    const CList or array

    Hi,

    I need to create a list or array of CStrings within a function that will stay in memory next time I come into the function.

    I tried:

    Code:
    CString groupFound = "tempGroup"
    
    const CList <CString, CString> myGroups;
    
    myGroups.Addtail ( groupFound );
    I get the following error:

    error C2663: 'AddTail' : 2 overloads have no legal conversion for 'this' pointer

    Any ideas?

    thanks

  2. #2
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: const CList or array

    Quote Originally Posted by rudyloo
    I need to create a list or array of CStrings within a function that will stay in memory next time I come into the function.
    You're looking for the keyword static.

    Quote Originally Posted by rudyloo
    error C2663: 'AddTail' : 2 overloads have no legal conversion for 'this' pointer
    What did you expect? AddTail is a non-const function -- you, on the other hand, are trying to invoke it on a const object.

    Other than that, this isn't really the right forum for MFC stuff...

  3. #3
    Join Date
    Jan 2007
    Posts
    97

    Re: const CList or array

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured