Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: vector iterators incompatible

  1. #1
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default vector iterators incompatible

    Hi,

    I have C + + libraries which were made under Linux and compiled with GCC.
    vector iterators incompatible . I finally managed to compile under VisualStudio but when running a test, I have the following error: vector iterators incompatible.

    Name:  error.png
Views: 567
Size:  14.7 KB

    I have absolutely no idea of the problem. I confess that I remain perplexed as to the results of my research on the web to find an explanation.

    If I just look in the code, I find things like this:

    Code:
    # for (vector <AnnotatedArc *>:: iterator iter = ptrDownstreamArcs-> begin ();
    # iter != ptrDownstreamArcs->end (); iter! = ptrDownstreamArcs-> end ();
    # ++iter) + + iter)
    # { (
    Have you any idea which does not like to VS?

    Linux/GCC 4.3, my testing goes smoothly.

    If you have an idea, a track or an explanation, I'm interested ...

    Thank you for your help.

  2. #2
    quentin kenihan is offline Junior Member
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

    Default

    The problem is not in what you watch. You probably compares two iterations on different containers, or perhaps with an invalid iterator.

  3. #3
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    ok.

    Is this a template problem? why then my test passes under gcc? Is there a different use of templates in VS?

    It would mean what an iterator invalid?

    Manipulation of the vector which are not allowed?

    Thank you for your help

  4. #4
    quentin kenihan is offline Junior Member
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

    Default

    You do not show template ...

    Undefined behavior, cant do anything. Including this is what you expect. Are you trying with the version of gcc lib conducts audits?

    pe an iterator that has not been initialized, or whose container has been destroyed, or the element that is "advanced" by the iterator has been destroyed ...

  5. #5
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    I speak of the class vector of STL lib:

    Code:
    template <class _Ty, _Ax class> class vector: public _Vector_val <_Ty, _Ax>
    I tell myself that I can be a problem with ca ...

    Code:
    Undefined behavior, ca do anything. Including this is what you expect. Are you trying with the version of gcc lib conducts audits?
    What version of gcc are you talking about?
    FYI, I use the libraries exist and are used for several years in Linux / gcc. I assume it's ok in this environment there.

    But if I can do a test to ensure thanks to your "version of gcc that conducts audits, it is trying ... necessary because although I find the bug.

    Code:
    pe an iterator that has not been initialized, or whose container has been destroyed, or the element that is "advanced" by the iterator has been destroyed ...
    I continue the investigation to try to find the probleme but not win

    I remain connected to fofo, if you have any ideas ...

    thank you for your help "A programmer" because there is no crowd today ....

  6. #6
    Linda Darnell is offline Junior Member
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default

    And you can not give us the portion of code where it crashes?

  7. #7
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    I go in debug and when I targeted precisely the lines that problem, I post.

    ... But I confess that I am not super efficient, it's not my code, I know the libs ... I start with brief these libraries ...

    I come back asap with the code you put in the tooth.

  8. #8
    quentin kenihan is offline Junior Member
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

    Default

    Starts with you that there is a problem in your code. It's much more likely.

  9. #9
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    ok thank you. Although noted.

    I will try the debug mode you speak.

    Thank you

  10. #10
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    hi
    After a short break on other projects equally gratifying, I return to my problem.

    I just provide additional information which I hope will give you ideas on the problem I encounter.

    Well, I always error "vector iterators incompatible". I located the crash.

    Il ya dans le code un test != entre 2 objets de classe

    There is in the code test! = Between 2 objects of class std:: _Vector_const_iterator <Arc, std:: allocator <arc>>, where Arc is a class library.

    It therefore plant operator! Of _Vector_const_iterator = (c: \ Program Files \ Microsoft Visual Studio 9.0 \ VC \ include \ vector)

    The test is:

    Code:
    if (crossing! = toBeTested)
    A watch on crossing gives me:

    Code:
    - (Crossing axe_ ={...} cos_ =- 0.087155742747658235 sin_ = 0.99619469809174555 ...) std:: _Vector_const_iterator <Arc, std:: allocator <arc>>
    -  ptr {axe_={...} cos_=-0.087155742747658235 sin_=0.99619469809174555 ...} Arc - (Ptr axe_ ={...} cos_ =- 0.087155742747658235 sin_ = 0.99619469809174555 ...) Arc
    +  axe_ {x_=-0.50000000000000011 y_=-0.00000000000000000 z_=-0.86602540378443860 } Vecteur3<double> + Axe_ =- 0.50000000000000011 (x_ y_ z_ =- 0.00000000000000000 =- 0.86602540378443860) Vecteur3 <double>
    cos_ -0.087155742747658235 double cos_ -0.087155742747658235 double
    sin_ 0.99619469809174555 double sin_ 0.99619469809174555 double
    angle_ 1.6580627893946132 double angle_ 1.6580627893946132 double
    +  deb_ {x_=1.2490009027033011e-016 y_=-0.99492302985782377 z_=0.10063878307356444 } Vecteur3<double> Deb_ (x_ + = 1.2490009027033011e-016 =- 0.99492302985782377 y_ z_ = 0.10063878307356444) Vecteur3 <double>
    +  fin_ {x_=6.9388939039072284e-018 y_=0.99492302985782377 z_=0.10063878307356451 } Vecteur3<double> Fin_ (x_ + = 6.9388939039072284e-018 = 0.99492302985782377 y_ z_ = 0.10063878307356451) Vecteur3 <double>
    +  u_ {x_=-0.043577871373829000 y_=-0.99492302985782377 z_=0.025159695768391069 } Vecteur3<double> + U_ (x_ =- 0.043577871373829000 y_ z_ =- 0.99492302985782377 = 0.025159695768391069) Vecteur3 <double>
    +  v_ {x_=-0.86162861866705887 y_=0.050319391536782124 z_=0.49746151492891200 } Vecteur3<double> + V_ (x_ =- 0.86162861866705887 y_ z_ = 0.050319391536782124 = 0.49746151492891200) Vecteur3 <double>
    +  w_ {x_=0.043577871373829125 y_=0.00000000000000000 z_=0.075479087305173373 } Vecteur3<double> + W_ (x_ = 0.043577871373829125 y_ z_ = 0.00000000000000000 = 0.075479087305173373) Vecteur3 <double>
    balayage_ 3.0405264385097688 double balayage_ 3.0405264385097688 double
    A watch on toBeTested gives me:

    Code:
    - ToBeTested (axe_ ={...} cos_ = 2.2459367226747943e-299 sin_ = 6.4615620656525586e-308 ...) std:: _Vector_const_iterator <Arc, std:: <arc> allocator>
    -  ptr {axe_={...} cos_=2.2459367226747943e-299 sin_=6.4615620656525586e-308 ...} Arc - (Ptr axe_ ={...} cos_ = 2.2459367226747943e-299 sin_ = 6.4615620656525586e-308) Arc ...
    +  axe_ {x_=-2.5301711256524607e-098 y_=-2.6569838326172271e+303 z_=0.00000000000000000 } Vecteur3<double> + Axe_ (x_ =- 2.5301711256524607e-098 y_ z_ =- 2.6569838326172271e 303 = 0.00000000000000000) Vecteur3 <double>
    cos_ 2.2459367226747943e-299 double cos_ 2.2459367226747943e-299 double
    sin_ 6.4615620656525586e-308 double sin_ 6.4615620656525586e-308 double
    angle_ -2.6569842580370804e+303 double angle_-2.6569842580370804e 303 double
    +  deb_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> Deb_ (+ 2.6569842580370804e 303 =- x_ y_ z_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303) Vecteur3 <double>
    +  fin_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> Fin_ (+ 2.6569842580370804e 303 =- x_ y_ z_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303) Vecteur3 <double>
    +  u_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + U_ (x_ y_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    +  v_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + V_ (x_ y_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    +  w_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + W_ (x_ y_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    balayage_ -2.6569842580370804e+303 double balayage_-2.6569842580370804e 303 double
    In class _Vector_const_iterator:

    Code:
    # template <class _Ty, class _Alloc> class (_Vector_const_iterator
    # ..... .....
    # bool operator !=( const _Myt& _Right) const bool operator! = (const _Myt _Right &) const
    # { // test for iterator inequality (/ / Test for iterator inequality
    # return (!(* this == _Right)); return ((* this == _Right));
    # } )
    # .... ....
    # }; );
    A watch on * this:

    Code:
    - (* This axe_ ={...} cos_ =- 0.087155742747658235 sin_ = 0.99619469809174555 ...) const std:: _Vector_const_iterator <Arc, std:: allocator <arc>>
    -  ptr {axe_={...} cos_=-0.087155742747658235 sin_=0.99619469809174555 ...} Arc - (Ptr axe_ ={...} cos_ =- 0.087155742747658235 sin_ = 0.99619469809174555 ...) Arc
    +  axe_ {x_=-0.50000000000000011 y_=-0.00000000000000000 z_=-0.86602540378443860 } Vecteur3<double> + Axe_ =- 0.50000000000000011 (x_ y_ z_ =- 0.00000000000000000 =- 0.86602540378443860) Vecteur3 <double>
    cos_ -0.087155742747658235 double cos_ -0.087155742747658235 double
    sin_ 0.99619469809174555 double sin_ 0.99619469809174555 double
    angle_ 1.6580627893946132 double angle_ 1.6580627893946132 double
    +  deb_ {x_=1.2490009027033011e-016 y_=-0.99492302985782377 z_=0.10063878307356444 } Vecteur3<double> Deb_ (x_ + = 1.2490009027033011e-016 =- 0.99492302985782377 y_ z_ = 0.10063878307356444) Vecteur3 <double>
    +  fin_ {x_=6.9388939039072284e-018 y_=0.99492302985782377 z_=0.10063878307356451 } Vecteur3<double> Fin_ (x_ + = 6.9388939039072284e-018 = 0.99492302985782377 y_ z_ = 0.10063878307356451) Vecteur3 <double>
    +  u_ {x_=-0.043577871373829000 y_=-0.99492302985782377 z_=0.025159695768391069 } Vecteur3<double> + U_ (x_ =- 0.043577871373829000 y_ z_ =- 0.99492302985782377 = 0.025159695768391069) Vecteur3 <double>
    +  v_ {x_=-0.86162861866705887 y_=0.050319391536782124 z_=0.49746151492891200 } Vecteur3<double> + V_ (x_ =- 0.86162861866705887 y_ z_ = 0.050319391536782124 = 0.49746151492891200) Vecteur3 <double>
    +  w_ {x_=0.043577871373829125 y_=0.00000000000000000 z_=0.075479087305173373 } Vecteur3<double> + W_ (x_ = 0.043577871373829125 y_ z_ = 0.00000000000000000 = 0.075479087305173373) Vecteur3 <double>
    balayage_ 3.0405264385097688 double balayage_ 3.0405264385097688 double
    A watch on _Right:

    Code:
    - (_Right Axe_ ={...} cos_ = 2.2459367226747943e-299 sin_ = 6.4615620656525586e-308 ...) const std:: _Vector_const_iterator <Arc, std:: allocator <arc>> &
    -  ptr {axe_={...} cos_=2.2459367226747943e-299 sin_=6.4615620656525586e-308 ...} Arc - (Ptr axe_ ={...} cos_ = 2.2459367226747943e-299 sin_ = 6.4615620656525586e-308) Arc ...
    +  axe_ {x_=-2.5301711256524607e-098 y_=-2.6569838326172271e+303 z_=0.00000000000000000 } Vecteur3<double> + Axe_ (x_ =- 2.5301711256524607e-098 y_ z_ =- 2.6569838326172271e 303 = 0.00000000000000000) Vecteur3 <double>
    cos_ 2.2459367226747943e-299 double cos_ 2.2459367226747943e-299 double
    sin_ 6.4615620656525586e-308 double sin_ 6.4615620656525586e-308 double
    angle_ -2.6569842580370804e+303 double angle_-2.6569842580370804e 303 double
    +  deb_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> Deb_ (+ 2.6569842580370804e 303 =- x_ y_ z_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303) Vecteur3 <double>
    +  fin_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> Fin_ (+ 2.6569842580370804e 303 =- x_ y_ z_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303) Vecteur3 <double>
    +  u_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + U_ (x_ y_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    +  v_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + =- V_ (x_ y_ 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    +  w_ {x_=-2.6569842580370804e+303 y_=-2.6569842580370804e+303 z_=-2.6569842580370804e+303 } Vecteur3<double> + W_ (x_ y_ =- 2.6569842580370804e 303 =- 2.6569842580370804e 303 z_ =- 2.6569842580370804e 303) Vecteur3 <double>
    balayage_ -2.6569842580370804e+303 double balayage_-2.6569842580370804e 303 double
    I understand yet what bothers

    Someone would have any idea??

    Meanwhile, I go with Linux, follow the advice of a programmer and see if I find something fishy qq ...

    Please, help me!

    Thank you for your help

  11. #11
    Linda Darnell is offline Junior Member
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default

    Post the function body where your error occurs, not just a line of comparison with variables coming from who knows where....

  12. #12
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    Here is the code that the calling function:

    Code:
    # void
    # Field::firstCrossing (Arc *ptrArc, Loop::const_iterator *ptrCrossing) const Field: firstCrossing (Arc * ptrArc, Loop:: const_iterator ptrCrossing *) const;
    # throw (CantorErreurs) throw (CantorErreurs)
    # { (
    #
    # // find the first crossing / / Find the first crossing
    # VecDBL v1, v2; VecDBL v1, v2;
    # int nbInt; int nbInt;
    # Loop::const_iterator crossing = boundary_.begin ()->end (); Loop:: const_iterator crossing boundary_.begin = () -> end ();
    # for (Boundary::const_iterator i = boundary_.begin (); for (Boundary:: const_iterator i = boundary_.begin ();
    # i != boundary_.end (); i! boundary_.end = ();
    # ++i) + + i)
    # for (Loop::const_iterator j = i->begin (); j != i->end (); ++j) for (Loop:: const_iterator j = i-> begin () j "= i-> end (), + + j)
    # { (
    # ptrArc->intersection (*j, &nbInt, &v1, &v2); ptrArc-> intersect (* j & nbInt, & v1, & v2);
    # if (nbInt > 0) if (nbInt> 0)
    # { (
    # *ptrArc = Arc (ptrArc->debut (), v1); * ptrArc = Arc (ptrArc-> start (), v1);
    # crossing = j; crossing = j;
    # } )
    # } )
    #
    # Loop::const_iterator toBeTested = boundary_.begin ()->end (); Loop:: const_iterator toBeTested = boundary_.begin () -> end ();
    #
    # // verify we stay away from the vertices / / Verify we stay away from the vertices
    # if (crossing != toBeTested) if (crossing! = toBeTested)
    # { (
    # if ((ptrArc->fin ().angleAvecVecteur(crossing->debut ()) > small) if ((ptrArc-> end (). angleAvecVecteur (crossing-> start ())> small)
    # && (ptrArc->fin ().angleAvecVecteur(crossing->fin   ()) > small)) & & (PtrArc-> end (). AngleAvecVecteur (crossing-> end ())> small))
    # *ptrCrossing = crossing; * = ptrCrossing crossing;
    # } )
    #
    # } )

  13. #13
    Linda Darnell is offline Junior Member
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default

    where Boundary_ is an empty vector, I did not know what is happening, this is not the case then you meet?

  14. #14
    rachel house is offline Junior Member
    Join Date
    Oct 2009
    Posts
    21
    Rep Power
    0

    Default

    No, I do not think since toBeTested can be recovered (not empty):

    Code:
    Loop:: const_iterator toBeTested = boundary_.begin () -> end ();
    Code:
    + ToBeTested (axe_ ={...} cos_ = 2.2459367226747943e-299 sin_ = 6.4615620656525586e-308 ...) std:: _Vector_const_iterator <Arc, std:: allocator <arc>>

  15. #15
    armin dillenberger is offline Junior Member
    Join Date
    Oct 2009
    Posts
    12
    Rep Power
    0

    Default

    end () returns an iterator invalid (its behavior), then not.

Page 1 of 2 12 LastLast

Similar Threads

  1. Vector Magic 1.17
    By reddevils in forum Operating System
    Replies: 0
    Last Post: 06-19-2010, 06:22 PM
  2. Blu-ray players are incompatible with large Blu-Ray discs
    By ruel in forum Latest Hardware News
    Replies: 0
    Last Post: 10-17-2009, 07:06 AM
  3. Replies: 0
    Last Post: 10-12-2009, 12:27 PM
  4. Apple Posts Mac OS X 10.6-Incompatible Software
    By Alan Knott in forum Latest Hardware News
    Replies: 0
    Last Post: 08-30-2009, 07:11 AM
  5. Vector Linux 6.0 review
    By Francis Ronaldo in forum Linux/Free BSD
    Replies: 0
    Last Post: 06-02-2009, 07:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48