title: Do I need to use a weak pointer when using C++ `function` blocks (as opposed to Objective C blocks)
body: <p>If you capture a strong reference to <code>self</code> under ARC in an objective-C style block, you need to use a <code>__weak</code> pointer to avoid an ARC "retain cycle" problem.</p>
  
  <pre><code>// Right way:
  - (void)configureBlock {
    XYZBlockKeeper * __weak weakSelf = self;
    self.block = ^{
      [weakSelf doSomething];   // capture the weak reference
                                // to avoid the reference cycle
    }
  }
  </code></pre>
  
  <p>I really don't know what a retain cycle is, but <a href="https://stackoverflow.com/a/8577814/111307">this answer</a> describes it a bit.  I just know you should use a <code>__weak</code> pointer for Objective-C style blocks. See <a href="http://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html" rel="nofollow noreferrer">Avoid Strong Reference Cycles when Capturing self</a>.</p>
  
  <p>But my question is, do I need to create a weak pointer when capturing <code>self</code> under a C++ <code>&lt;functional&gt;</code> block?</p>
  
  <pre><code>- (void)configureBlock {
    self.block = [self](){
      [self doSomething]; // is this ok? It's not an objective C block.
    }
  }
  </code></pre>