#include <iostream>
namespace x {
template <typename... Ts>
struct make_void {
typedef void type;
};
template <typename... Ts> using void_t = typename make_void<Ts...>::type;
template <class T>
using dereference_t = decltype(*std::declval<T>());
namespace detail {
template <class T, class = void>
struct is_iterator_impl : std::false_type {};
template <class T>
struct is_iterator_impl<T, void_t<dereference_t<T>>> : std::true_type {};
template <class T, bool = false>
struct is_const_iterator_impl : std::false_type {};
template <class T>
struct is_const_iterator_impl<T, true> : std::is_const<std::remove_reference_t<dereference_t<T>>> {};
} // namespace detail
template <class T>
struct is_iterator : detail::is_iterator_impl<T> {};
template <class T>
struct is_const_iterator : detail::is_const_iterator_impl<T, is_iterator<T>::value> {};
} // namespace x
int main() {
std::cout << x::is_const_iterator<int>::value << std::endl;
std::cout << x::is_const_iterator<int*>::value << std::endl;
std::cout << x::is_const_iterator<const int*>::value << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKbmFtZXNwYWNlIHggewoKdGVtcGxhdGUgPHR5cGVuYW1lLi4uIFRzPgpzdHJ1Y3QgbWFrZV92b2lkIHsKICAgIHR5cGVkZWYgdm9pZCB0eXBlOwp9OwoKdGVtcGxhdGUgPHR5cGVuYW1lLi4uIFRzPiB1c2luZyB2b2lkX3QgPSB0eXBlbmFtZSBtYWtlX3ZvaWQ8VHMuLi4+Ojp0eXBlOwoKdGVtcGxhdGUgPGNsYXNzIFQ+CnVzaW5nIGRlcmVmZXJlbmNlX3QgPSBkZWNsdHlwZSgqc3RkOjpkZWNsdmFsPFQ+KCkpOwoKbmFtZXNwYWNlIGRldGFpbCB7Cgp0ZW1wbGF0ZSA8Y2xhc3MgVCwgY2xhc3MgPSB2b2lkPgpzdHJ1Y3QgaXNfaXRlcmF0b3JfaW1wbCA6IHN0ZDo6ZmFsc2VfdHlwZSB7fTsKCnRlbXBsYXRlIDxjbGFzcyBUPgpzdHJ1Y3QgaXNfaXRlcmF0b3JfaW1wbDxULCB2b2lkX3Q8ZGVyZWZlcmVuY2VfdDxUPj4+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