sfinae: enable_if condition
<p>I always only see enable_if is used with the condition std::is_integral::value.</p>

<p>Is there a way to use in the condition a function-call of a memberfunction of an object of another templateclass? The function I'm talking about should look like this:</p>

<pre><code>bool someFunc()
{
    if (QString(T::staticMetaObject.className()) == QString("Form")) {
        return true;
    }
    return false;   
}
</code></pre>

<p>Currently I cannot get it compiled no matter what I try.</p>

<p>Thank you for helping me.</p>

<p><strong>edit:</strong></p>

<p>that my question is more clear more code and an error msg.</p>

<p>mainwindow.cpp</p>

<pre><code>#include "mainwindow.h"
#include "ui_mainwindow.h"
#include &lt;iostream&gt;
#include &lt;type_traits&gt;
#include &lt;QDebug&gt;

template &lt;class T&gt;
typename std::enable_if&lt;Form&lt;MainWindow&gt;::staticThis-&gt;someFunc(),bool&gt;::type
  is_smth (T* obj) { return true; }

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui-&gt;setupUi(this);

    form = new Form&lt;MainWindow&gt;;

    qDebug() &lt;&lt; is_smth(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}
</code></pre>

<p>mainwindow.h</p>

<pre><code>#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include &lt;QMainWindow&gt;
#include "form.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

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

    Form&lt;MainWindow&gt;* form;

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
</code></pre>

<p>form.h</p>

<pre><code>#ifndef FORM_H
#define FORM_H
#include &lt;QObject&gt;

class FormBase : public QObject
{
    Q_OBJECT
};

template &lt;class T&gt;
class Form : public FormBase
{
public:
    Form() {}

    static Form* staticThis;

    bool someFunc()
    {
        if (QString(T::staticMetaObject.className()) == QString(Form::staticMetaObject.className())) {
            return true;
        }
        return false;
    }
};

#endif // FORM_H
</code></pre>

<p>form.cpp</p>

<pre><code>#include "form.h"
#include "mainwindow.h"

Form&lt;MainWindow&gt;* Form::staticThis = NULL;
</code></pre>

<p>error:</p>

<p>the value of 'Form::staticThis' is not usable in a constant expression
 typename std::enable_if::staticThis->someFunc(),bool>::type
                                                                ^</p>

<p>I'm do not want to use in condition of enable_if a function from std or something. I want to use my own function. And i don't know how to get it work. Maybe thats why you will think the code is a little bit busy. But i think it should show now what I'm trying to accomplish.</p>

<p>Thank you again</p>