Reputation: 3358
I am writing a SFINAE matching class which can match a pointer to collection type.
We currently have std::is_pointer and I have written:
// SFINAE test for const_iterator for member type
template <typename T>
class has_const_iterator{
private:
typedef char True;
typedef long False;
template <typename C> static True test(typename C::const_iterator*) ;
template <typename C> static False test(...);
public:
enum { value = sizeof(test<T>(0)) == sizeof(char) };
};
How can I use both std::is_pointer and has_const_iterator in a std::enable_if or how can I write a new type traits that can match a pointer to collection type? Thanks.
Upvotes: 1
Views: 193