-2

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'

streamc
  • 676
  • 3
  • 11
  • 27
  • 1
    There are a lot of inconsistencies in this question that make me think this is not your actual code but a manual copy of it: What is `orion_index_hash`? What is `item`? Are you aware that the two occurrences of `index_hash` have different types? There's also more things I'd like to know: Does your `.cpp` file `#include` your `.h` file? Are there namespaces at play here? Where do you see the error (runtime, compile time)? Is that the complete error message? Etc. Basically, please post a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). – Ken Wayne VanderLinde Dec 18 '20 at 04:31
  • Before I post values I usually chage my actual names to more common, Yes, cpp include .h file I edited file. I do not use .cpp so QHash * index_hash; – streamc Dec 18 '20 at 04:33

1 Answers1

0
 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.

streamc
  • 676
  • 3
  • 11
  • 27