#include <iostream>
#include <iterator>
#include <map>
#include <functional>
#include <type_traits>
int main()
{
/////////////// scary iterators check /////////////////////////
using map_type_one = std::map< int, char, std::less<int> > ;
// container with same value_type etc, but different comparator
using map_type_two = std::map< int, char, std::greater<int> > ;
bool containers_are_of_same_type = std::is_same<map_type_one,map_type_two>::value ;
std::cout << "containers are of same type? " << std::boolalpha
<< containers_are_of_same_type << '\n' ; // false
using iter_type_one = map_type_one::iterator ;
using iter_type_two = map_type_two::iterator ;
// is iter_type_one the same as iter_type_two ?
bool iterators_are_of_same_type = std::is_same<iter_type_one,iter_type_two>::value ;
std::cout << "iterators are of same type? "
<< iterators_are_of_same_type << '\n' ; // true
/////////////// OutputIterator EqualityComparable check /////////////////////////
using iterator = std::ostream_iterator<char> ;
iterator one(std::cout) ;
iterator two(std::cout) ;
one = two ; // fine: CopyAssignable
// one == two ; // error: not EqualityComparable
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aXRlcmF0b3I+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxmdW5jdGlvbmFsPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+CgppbnQgbWFpbigpCnsKICAgIC8vLy8vLy8vLy8vLy8vLyBzY2FyeSBpdGVyYXRvcnMgY2hlY2sgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLwoKICAgIHVzaW5nIG1hcF90eXBlX29uZSA9IHN0ZDo6bWFwPCBpbnQsIGNoYXIsIHN0ZDo6bGVzczxpbnQ+ID4gOwoKICAgIC8vIGNvbnRhaW5lciB3aXRoIHNhbWUgdmFsdWVfdHlwZSBldGMsIGJ1dCBkaWZmZXJlbnQgY29tcGFyYXRvcgogICAgdXNpbmcgbWFwX3R5cGVfdHdvID0gc3RkOjptYXA8IGludCwgY2hhciwgc3RkOjpncmVhdGVyPGludD4gPiA7CgogICAgYm9vbCBjb250YWluZXJzX2FyZV9vZl9zYW1lX3R5cGUgPSBzdGQ6OmlzX3NhbWU8bWFwX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