Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. stl set bug ?

stl set bug ?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brian van der Beek
    wrote on last edited by
    #1

    I have a stl set with pointers to objects. When I insert() a reference to one of these objects in the empty set I get an access violation in the while loop of the following code: void _Dec() {if (_Color(_Ptr) == _Red && _Parent(_Parent(_Ptr)) == _Ptr) _Ptr = _Right(_Ptr); else if (_Left(_Ptr) != _Nil) _Ptr = _Max(_Left(_Ptr)); else {_Nodeptr _P; while (_Ptr == _Left(_P = _Parent(_Ptr))) _Ptr = _P; _Ptr = _P; }} When I change the set to a list an push_back() the same object I works fine. Is this an stl bug, or must I be doing something wrong?

    A 1 Reply Last reply
    0
    • B Brian van der Beek

      I have a stl set with pointers to objects. When I insert() a reference to one of these objects in the empty set I get an access violation in the while loop of the following code: void _Dec() {if (_Color(_Ptr) == _Red && _Parent(_Parent(_Ptr)) == _Ptr) _Ptr = _Right(_Ptr); else if (_Left(_Ptr) != _Nil) _Ptr = _Max(_Left(_Ptr)); else {_Nodeptr _P; while (_Ptr == _Left(_P = _Parent(_Ptr))) _Ptr = _P; _Ptr = _P; }} When I change the set to a list an push_back() the same object I works fine. Is this an stl bug, or must I be doing something wrong?

      A Offline
      A Offline
      ankea
      wrote on last edited by
      #2

      hi, I have the same problem. how to solve this ?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups