container- und iteratorenproblem



  • Hallo!

    warum geht das

    vector<bool>::iterator bIter;
    vector<bool> *a = new vector<bool>; 
    bIter = a->begin();
    

    nicht aber das

    set< vector<bool> >::iterator vectorIter;
    vector<bool>::iterator bIter;
    set< vector<bool> > *vSet = new set< vector<bool> >;    	
    vectorIter = vSet->begin();
    bIter = (*vectorIter).begin();  //hier fehler
    

    ???
    Ich erhalte die Fehlermeldung:

    error: no match for 'operator=' in 'bIter = std::vector<bool, 
       _Alloc>::begin() const [with _Alloc = std::allocator<bool>]()'
    /usr/include/g++/bits/stl_bvector.h:153: error: candidates are: 
       std::_Bit_iterator& std::_Bit_iterator::operator=(const std::_Bit_iterator&)
    PartialK.cpp:96: error: no match for 'operator=' in 'bIter = std::vector<bool, 
       _Alloc>::begin() const [with _Alloc = std::allocator<bool>]()'
    /usr/include/g++/bits/stl_bvector.h:153: error: candidates are: 
       std::_Bit_iterator& std::_Bit_iterator::operator=(const std::_Bit_iterator&)
    

    ???

    Vielen Dank für Ihre Unterstützung!
    Grüße, Raphael :xmas2



  • Bei mir funktioniert es einwandfrei. Warum eigentlich (*vectorIter).begin() und nicht vectorIter->begin()? Ist das gleiche.


Anmelden zum Antworten