• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
STL set inside inside a class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

STL set inside inside a class


  • Subject: STL set inside inside a class
  • From: mark <email@hidden>
  • Date: Thu, 18 May 2006 09:48:10 +1200

Title: STL set inside inside a class
Hello.

I have a class with a set defined in it.

class GenericTree {
     TreeObjectRef *toBlock;
// 0 is usually the root
        UInt16 refCount;
        UInt16 maxItems;
       
void* root;
     UInt16 itemCount;
        std::map<const int, UInt16> depthCount; // number of objects at depth X
        ...
}

And a method in the class

void GenericTree::CalcDepthRecursive(SInt16 index, SInt16 depth) {
      UInt16 t;
        if (depth>maxDepth) {return;}
        ...
        std::map<const int, UInt16>::iterator end=depthCount.end();
    
if (depthCount.find(depth)!=end) {
              depthCount[depth]++;
            }
      
else {
                depthCount[depth]=1; (1)
                }
        ...
        };
}
(1) causes an EXC_BAD_ACCESS somewhere deep inside the bowels of set.
If the depthCount is not in a class, it works fine,

operator--()
      {
     _M_node = _Rb_tree_decrement(_M_node); <<< here
return *this;
      }

Is this an implementation issue for set or doesn't set like living inside a class?
I have only started using STL receently.
XCode 2.2.1, OS 10.4.6

TIA
Mark
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: STL set inside inside a class (sorry. Fixed)
      • From: mark <email@hidden>
    • Re: STL set inside inside a class
      • From: Paul Forgey <email@hidden>
  • Prev by Date: Re: dead-code stripping, pass two...
  • Next by Date: Re: Find Fast
  • Previous by thread: Re: Find Fast
  • Next by thread: Re: STL set inside inside a class
  • Index(es):
    • Date
    • Thread