Replace qhash value no operator found which takes a right-hand operand of type

132 Views Asked by At

I have

QHash<int,MyClass*> * index_hash;

value in .h file

I have (MyClass*item) that pass as function param

I can go through with

myFunc (MyClass*item) {
    QHash<int, MyClass*> ::iterator itt;
    
    
    for (it =  index_hash->begin(); it !=  index_hash->end(); ++it)
             
           { 
                
    
    
                
           }
       
}

How can I replace concrete index_hash value? I do not mean replace in iterator. Replace anyway. I know index.

I try index_hash[1]=item;

and get error C2679: binary

binary '<<' : no operator found which takes a right-hand operand of type 'MyClass'

1

There are 1 best solutions below

0
On
 QHash<int, MyClass*> ::iterator itt;

 for (it =  index_hash->begin(); it !=  index_hash->end(); ++it)
         
       { 
            
         itt.value()=item;

            
       }

Simple ansert but I really do not know why it was not working yesterday.