CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    121

    How can I pass my whole session

    Hello, can someone explain to me why (*pSession) is not the right way to pass my whole Session.

    Thank You

    static void DoEnumSession( CTreeCtrl &ctlTree, HTREEITEM item, const vector<Session> &sessionToDelete)
    {
    Session *pSession= (Session *) ctlTree.GetItemData( item);
    if( pSession != NULL) {
    sessionToDelete.push_back( *pSession);
    }
    else{
    HTREEITEM childItem= ctlTree.GetChildItem( item);
    while( childItem != NULL) {
    DoEnumSession( ctlTree, childItem, sessionToDelete);
    childItem= ctlTree.GetNextSiblingItem( childItem);
    }
    }
    }

    Error I get:
    K:\projet2\VRUtilities\VRUtilitiesTree.cpp(326) : error C2662: 'push_back' : cannot convert 'this' pointer from 'const class std::vector<class Session,class std::allocator<class Session> >' to 'class std::vector<class Session,class std::allocator<cl
    *** Session> > &'
    Conversion loses qualifiers


  2. #2
    Guest

    Re: How can I pass my whole session

    Try copying sessionToDelete and performing your operations on the copy. I have had a lot of problems because the compiler does not like you to alter arguments passed as const.


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