#include <type_traits>
#include <iterator>
#include <list>
#include <vector>
template<typename T, typename = void>
struct is_const_iterator : std::false_type { };
template<typename T>
struct is_const_iterator<T,
typename std::enable_if<
std::is_const<
typename std::remove_pointer<
typename std::iterator_traits<T>::pointer
>::type
>::value
>::type> : std::true_type { };
int main()
{
typedef std::list<int>::iterator LI;
typedef std::list<int>::const_iterator CLI;
static_assert(is_const_iterator<LI>::value, "!"); // Fires
static_assert(is_const_iterator<CLI>::value, "!"); // Does not fire
typedef std::vector<int>::iterator VI;
typedef std::vector<int>::const_iterator CVI;
static_assert(is_const_iterator<VI>::value, "!"); // Fires
static_assert(is_const_iterator<CVI>::value, "!"); // Does not fire
}
ICAgICNpbmNsdWRlIDx0eXBlX3RyYWl0cz4KICAgICNpbmNsdWRlIDxpdGVyYXRvcj4KICAgICNpbmNsdWRlIDxsaXN0PgogICAgI2luY2x1ZGUgPHZlY3Rvcj4KCiAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBULCB0eXBlbmFtZSA9IHZvaWQ+CiAgICBzdHJ1Y3QgaXNfY29uc3RfaXRlcmF0b3IgOiBzdGQ6OmZhbHNlX3R5cGUgeyB9OwoKICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CiAgICBzdHJ1Y3QgaXNfY29uc3RfaXRlcmF0b3I8VCwKICAgICAgICB0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjwKICAgICAgICAgICAgc3RkOjppc19jb25zdDwKICAgICAgICAgICAgICAgIHR5cGVuYW1lIHN0ZDo6cmVtb3ZlX3BvaW50ZXI8CiAgICAgICAgICAgICAgICAgICAgdHlwZW5hbWUgc3RkOjppdGVyYXRvcl90cmFpdHM8VD46OnBvaW50ZXIKICAgICAgICAgICAgICAgICAgICA+Ojp0eXBlCiAgICAgICAgICAgICAgICA+Ojp2YWx1ZQogICAgICAgICAgICA+Ojp0eXBlPiA6IHN0ZDo6dHJ1ZV90eXBlIHsgfTsKCiAgICBpbnQgbWFpbigpCiAgICB7CiAgIC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