Click to See Complete Forum and Search --> : How can I pass my whole session


Sophie
April 9th, 1999, 11:14 AM
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

April 9th, 1999, 03:22 PM
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.