string iterator not dereferencable



  • Bei mir kommt beim Dereferenzieren eines string::const_iterator in folgendem Quelltextauszug der Fehler "string iterator not dereferencable":

    reference operator*() const
    		{	// return designated object
     #if _ITERATOR_DEBUG_LEVEL == 2
    		if (this->_Getcont() == 0
    			|| this->_Ptr == 0
    			|| this->_Ptr < ((_Mystr *)this->_Getcont())->_Myptr()
    			|| ((_Mystr *)this->_Getcont())->_Myptr()
    				+ ((_Mystr *)this->_Getcont())->_Mysize <= this->_Ptr)
    			{	// report error
    			_DEBUG_ERROR("string iterator not dereferencable");
    			_SCL_SECURE_OUT_OF_RANGE;
    			}
    

    Genauer bei der Abfrage

    || ((_Mystr *)this->_Getcont())->_Myptr()
    				+ ((_Mystr *)this->_Getcont())->_Mysize <= this->_Ptr)
    

    Woran kann das liegen?



  • Habs hinbekommen. Man musste vor dem Dereferenzieren testen, ob das Ende schon erreicht ist.


Anmelden zum Antworten