This is an exact duplicate of this question, except that accepted answer is wrong, so I ask it again:
How do you correctly check to see if
How about something like this?
template
struct is_iterator
{
static constexpr bool value = false;
};
template
struct is_iterator::value_type, void>::value>::type>
{
static constexpr bool value = true;
};
example:
#include
#include
#include
template
struct is_iterator
{
static constexpr bool value = false;
};
template
struct is_iterator::value_type, void>::value>::type>
{
static constexpr bool value = true;
};
int main()
{
static_assert(!is_iterator::value, "ass");
static_assert(is_iterator::value, "ass");
static_assert(is_iterator::iterator>::value, "ass");
}
http://liveworkspace.org/code/7dcf96c97fd0b7a69f12658fc7b2693e