How to access member pointers in template functions
<pre><code>class A
{
  pointer* p;
  template&lt;class T&gt; f(T a)
  {
    p-&gt;property()-&gt;doSomething(a); // doSomething is a template function
  }
};
</code></pre>

<p>Above won't compile, but I want to access the member pointer in the template function even though it's unsafe. The reason I want to do this is because 'p->property()->doSomething(a)' is actually really really long, and I'm tried of rewriting it (and I don't want to use #define). So, how do I do something like that?</p>

<p>Edit: doSomething is a 3rd party function... but I think it is something like this:</p>

<pre><code>template&lt;class T&gt;
void doSomething(T a)
{
  // something
}
</code></pre>

<p>Edit: here's the actual code:</p>

<pre><code>#include &lt;QMainWindow&gt;
#include &lt;QtNetwork&gt;
#include &lt;QtWebKit&gt;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void replyFinished(QNetworkReply*);


private:
    Ui::MainWindow *ui;
    QNetworkAccessManager *nam;
    QUrl _url;

    void outputHeader(QNetworkReply*);

    template&lt;class T&gt; void writeToOuput(T arg)
    {
        ui-&gt;textEdit-&gt;append(QString("%1").arg(arg));
    }
};
</code></pre>

<p>Edit: Here's the error I'm getting: 'invalid use of incomplete type ui::MainWindow'
When I click it, it goes to this line 'ui->textEdit->append(QString("%1").arg(arg));' in the code</p>

<p>Edit: Here's the other error: 'Forward declaration of Ui::MainWindow'
When I click it, it goes no where.</p>
