title: How to use unordered_set that has elements that are vector of pair<int,int>
body: <p>I wanted to have something like </p>
  
  <pre><code> unordered_set&lt;vector&lt;pair&lt;int,int&gt;&gt;&gt; us;
  </code></pre>
  
  <p>but even without pair:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;unordered_set&gt;
  using namespace std;
  
  int main() {
      unordered_set&lt;vector&lt;int&gt;&gt; um;
  }
  </code></pre>
  
  <p>it fails:</p>
  
  <pre><code>In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::_Hash_code_base&lt;std::vector&lt;int&gt;, std::vector&lt;int&gt;, std::__detail::_Identity, std::hash&lt;std::vector&lt;int&gt; &gt;, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true&gt;’:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1402:10:   required from ‘struct std::__detail::_Hashtable_base&lt;std::vector&lt;int&gt;, std::vector&lt;int&gt;, std::__detail::_Identity, std::equal_to&lt;std::vector&lt;int&gt; &gt;, std::hash&lt;std::vector&lt;int&gt; &gt;, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits&lt;true, true, true&gt; &gt;’
  /usr/include/c++/4.8/bits/hashtable.h:174:11:   required from ‘class std::_Hashtable&lt;std::vector&lt;int&gt;, std::vector&lt;int&gt;, std::allocator&lt;std::vector&lt;int&gt; &gt;, std::__detail::_Identity, std::equal_to&lt;std::vector&lt;int&gt; &gt;, std::hash&lt;std::vector&lt;int&gt; &gt;, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits&lt;true, true, true&gt; &gt;’
  /usr/include/c++/4.8/bits/unordered_set.h:96:18:   required from ‘class std::unordered_set&lt;std::vector&lt;int&gt; &gt;’
  prog.cpp:7:32:   required from here
  /usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct _Hash_code_base&lt;_Key, _Value, _ExtractKey, _H1, _H2,
              ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct _Hash_code_base&lt;_Key, _Value, _ExtractKey, _H1, _H2,
              ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1082:53: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
         using __ebo_h1 = _Hashtable_ebo_helper&lt;1, _H1&gt;;
                                                       ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1082:53: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
         using __ebo_h1 = _Hashtable_ebo_helper&lt;1, _H1&gt;;
                                                       ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  prog.cpp: In constructor ‘std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::unordered_set(std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type, const hasher&amp;, const key_equal&amp;, const allocator_type&amp;) [with _Value = std::vector&lt;int&gt;; _Hash = std::hash&lt;std::vector&lt;int&gt; &gt;; _Pred = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _Alloc = std::allocator&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type = unsigned int; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::hasher = std::hash&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::key_equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::allocator_type = std::allocator&lt;std::vector&lt;int&gt; &gt;]’:
  prog.cpp:7:32: error: invalid use of incomplete type ‘std::unordered_set&lt;std::vector&lt;int&gt; &gt;::hasher {aka struct std::hash&lt;std::vector&lt;int&gt; &gt;}’
       unordered_set&lt;vector&lt;int&gt;&gt; um;
                                  ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘std::unordered_set&lt;std::vector&lt;int&gt; &gt;::hasher {aka struct std::hash&lt;std::vector&lt;int&gt; &gt;}’
       struct hash;
              ^
  prog.cpp:7:32: note:   when instantiating default argument for call to std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::unordered_set(std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type, const hasher&amp;, const key_equal&amp;, const allocator_type&amp;) [with _Value = std::vector&lt;int&gt;; _Hash = std::hash&lt;std::vector&lt;int&gt; &gt;; _Pred = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _Alloc = std::allocator&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type = unsigned int; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::hasher = std::hash&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::key_equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::allocator_type = std::allocator&lt;std::vector&lt;int&gt; &gt;]
       unordered_set&lt;vector&lt;int&gt;&gt; um;
                                  ^
  In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hash_code_base&lt;_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true&gt;::_Hash_code_base(const _ExtractKey&amp;, const _H1&amp;, const _H2&amp;, const std::__detail::_Default_ranged_hash&amp;) [with _Key = std::vector&lt;int&gt;; _Value = std::vector&lt;int&gt;; _ExtractKey = std::__detail::_Identity; _H1 = std::hash&lt;std::vector&lt;int&gt; &gt;; _H2 = std::__detail::_Mod_range_hashing]’:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1463:65:   required from ‘std::__detail::_Hashtable_base&lt;_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits&gt;::_Hashtable_base(const _ExtractKey&amp;, const _H1&amp;, const _H2&amp;, const _Hash&amp;, const _Equal&amp;) [with _Key = std::vector&lt;int&gt;; _Value = std::vector&lt;int&gt;; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _H1 = std::hash&lt;std::vector&lt;int&gt; &gt;; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits&lt;true, true, true&gt;]’
  /usr/include/c++/4.8/bits/hashtable.h:828:24:   required from ‘std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::_Hashtable(std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::size_type, const _H1&amp;, const _H2&amp;, const _Hash&amp;, const _Equal&amp;, const _ExtractKey&amp;, const allocator_type&amp;) [with _Key = std::vector&lt;int&gt;; _Value = std::vector&lt;int&gt;; _Alloc = std::allocator&lt;std::vector&lt;int&gt; &gt;; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _H1 = std::hash&lt;std::vector&lt;int&gt; &gt;; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits&lt;true, true, true&gt;; std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::size_type = unsigned int; std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::allocator_type = std::allocator&lt;std::vector&lt;int&gt; &gt;]’
  /usr/include/c++/4.8/bits/hashtable.h:397:26:   required from ‘std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::_Hashtable(std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::size_type, const _H1&amp;, const key_equal&amp;, const allocator_type&amp;) [with _Key = std::vector&lt;int&gt;; _Value = std::vector&lt;int&gt;; _Alloc = std::allocator&lt;std::vector&lt;int&gt; &gt;; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _H1 = std::hash&lt;std::vector&lt;int&gt; &gt;; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits&lt;true, true, true&gt;; std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::size_type = unsigned int; std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::key_equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; std::_Hashtable&lt;_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits&gt;::allocator_type = std::allocator&lt;std::vector&lt;int&gt; &gt;]’
  /usr/include/c++/4.8/bits/unordered_set.h:136:35:   required from ‘std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::unordered_set(std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type, const hasher&amp;, const key_equal&amp;, const allocator_type&amp;) [with _Value = std::vector&lt;int&gt;; _Hash = std::hash&lt;std::vector&lt;int&gt; &gt;; _Pred = std::equal_to&lt;std::vector&lt;int&gt; &gt;; _Alloc = std::allocator&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::size_type = unsigned int; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::hasher = std::hash&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::key_equal = std::equal_to&lt;std::vector&lt;int&gt; &gt;; std::unordered_set&lt;_Value, _Hash, _Pred, _Alloc&gt;::allocator_type = std::allocator&lt;std::vector&lt;int&gt; &gt;]’
  prog.cpp:7:32:   required from here
  /usr/include/c++/4.8/bits/hashtable_policy.h:1099:63: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
         : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { }
                                                                 ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                   from /usr/include/c++/4.8/unordered_set:47,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/hashtable_policy.h:1099:63: error: invalid use of incomplete type ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
         : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { }
                                                                 ^
  In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0,
                   from /usr/include/c++/4.8/vector:65,
                   from prog.cpp:1:
  /usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash&lt;std::vector&lt;int&gt; &gt;’
       struct hash;
              ^
  </code></pre>
  
  <p><a href="http://ideone.com/wusr5V">http://ideone.com/wusr5V</a></p>