title: how to expect pointer argument which is created later
body: <p>I have such group -> element to add/remove, with code snippt:</p>
  
  <pre><code>// production code:
  Group::add(Element* e) {...};
  Group::remove(Element* e) {...};
  ElementDerived::ElementDerived(Group* group){ group-&gt;add(this);}
  ElementDerived::~ElementDerived(Group* group){ group-&gt;remove(this);}
  </code></pre>
  
  <p>whenever i want to test the class <code>ElementDerived</code>, i have to do the following in the setup/teardown. However, how can I set the argument expectation explicitly without <code>_</code>?</p>
  
  <pre><code>// test code:
  struct Test_ElementDerived : public ::testing::Test {
    void SetUp() override {
      ElementDerived* p = nullptr;
      EXPECT_CALL(group, add(_)) // how to set expection on the pointer argument?
        .WillOnce(Invoke([&amp;p](auto base_ptr) {
          p = static_cast&lt;ElementDerived*&gt;(base_ptr);
        }));
      sut = std::make_unique&lt;ElementDerived&gt;(&amp;group);
    }
    void TearDown() override {
      EXPECT_CALL(group, remove(sut.get()));
    }
    MockGroup group{};
    std::unique_ptr&lt;ElementDerived&gt; sut;
  };
  </code></pre>