Compile Error mit Keyword auto



  • Mahlzeit,

    folgende Schleife:

    for(auto it = mMaterials.cbegin() + 1, itEnd = mMaterials.cend(); it != itEnd; ++it) {
    

    liefert bei mir diesen Fehler:
    [quote]
    error C3538: in a declarator-list 'auto' must always deduce to the same type
    [/quoerror C3538: in a declarator-list 'auto' must always deduce to the same typete]
    mMaterials.cbegin() + 1 sollte doch auch einen const_iterator liefern, oder? 😕



  • Da sollte wohl ein ; und kein , sein 😉



  • dot schrieb:

    Da sollte wohl ein ; und kein , sein 😉

    Nein. Der Kopf einer for-Schleife hat nur 3 Bereiche.



  • Scheint ein Bug zu sein. gcc frissts: http://ideone.com/IzRoQ

    Edit: Sieht jemand nen Unterschied?

    1>          kann 'std::_Vector_const_iterator<_Myvec>' sein
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<int,std::allocator<int>>
    1>          ]
    1>          oder "std::_Vector_const_iterator<_Myvec>"
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<int,std::allocator<int>>
    1>          ]
    


  • Robben@Bank schrieb:

    dot schrieb:

    Da sollte wohl ein ; und kein , sein 😉

    Nein. Der Kopf einer for-Schleife hat nur 3 Bereiche.

    Jap, zu ungenau gelesen 😉



  • Michael E. schrieb:

    Scheint ein Bug zu sein. gcc frissts: http://ideone.com/IzRoQ

    Edit: Sieht jemand nen Unterschied?

    1>          kann 'std::_Vector_const_iterator<_Myvec>' sein
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<int,std::allocator<int>>
    1>          ]
    1>          oder "std::_Vector_const_iterator<_Myvec>"
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<int,std::allocator<int>>
    1>          ]
    

    Ja. Bei ersten mal wurden Single-quotes verwendet, beim zweiten mal double-quotes. 😃


Anmelden zum Antworten