I know that it is possible to determine if class has certain member with SFINAE. But is there a way to determine if class has certain template method? For example:
class Foo {
public:
template<typename T>
int method(std::vector<T> vec);
};
I also know that you can detect particular instantiations of member template (i.e. for specified T). But I wonder if it possible at all to do so with arbitrary T?
EDIT:
To be more precise why I need T to be arbitrary type consider example:
class Foo {
public:
template<typename Derived>
void func(Eigen::ArrayBase<Derived> &&arr)
{
// implementation
}
};
using Matrix = Eigen::Array<double, -1, -1, Eigen::RowMajor>;
Matrix m1(10, 10);
Foo foo;
foo.func(m1.row(1));
foo.func(m1.col(1));
foo.func(m1.row(2).segment(2, 4));
func can be called with any of those expressions, but Derived inside those calls will be different:
- Eigen::Block<Eigen::Array<double, -1, -1, 1>, 1, -1, true>
- Eigen::Block<Eigen::Array<double, -1, -1, 1>, -1, 1, false>
- Eigen::Block<Eigen::Block<Eigen::Array<double, -1, -1, 1>, 1, -1, true>, 1, -1, false>