title: C++ how to insert array into hash set?
body: <p>I need to insert a 1D array into the hashset.</p>
  
  <p>But I got error while compiling.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;hash_set.h&gt;
  using namespace std;
  int hash_comp(const int* state1,const int* state2) {
      int result = 0;
  
      for (i = 0; i &lt; 16; i++) 
      {
          if (state1[i] != state2[i]) {
              result = -1;
          }
  
      }
      return result;
  }
  struct eqArray
  {
      bool operator()(const int* a1,const int* a2) const
    {
      return hash_comp(a1,a2) == 0;
    }
  };
  hash_set&lt;int*,hash&lt;int*&gt;,eqArray&gt; closelist;
  int main(int argc, char** argv)
  {
     const int sn[16] = {1,2,3,4,5,6,0,8,9,10,11,12,13,14,7,15};
     closelist.insert(sn);
     return 0;
  }
  </code></pre>
  
  
  
  <pre><code>/usr/include/c++/4.2.1/ext/hashtable.h: In member function 'size_t __gnu_cxx::hashtable&lt;_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc&gt;::_M_bkt_num_key(const _Key&amp;, size_t) const [with _Val = int*, _Key = int*, _HashFcn = __gnu_cxx::hash&lt;int*&gt;, _ExtractKey = std::_Identity&lt;int*&gt;, _EqualKey = std::equal_to&lt;int*&gt;, _Alloc = std::allocator&lt;int*&gt;]':
  /usr/include/c++/4.2.1/ext/hashtable.h:599:   instantiated from 'size_t __gnu_cxx::hashtable&lt;_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc&gt;::_M_bkt_num(const _Val&amp;, size_t) const [with _Val = int*, _Key = int*, _HashFcn = __gnu_cxx::hash&lt;int*&gt;, _ExtractKey = std::_Identity&lt;int*&gt;, _EqualKey = std::equal_to&lt;int*&gt;, _Alloc = std::allocator&lt;int*&gt;]'
  /usr/include/c++/4.2.1/ext/hashtable.h:1006:   instantiated from 'void __gnu_cxx::hashtable&lt;_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc&gt;::resize(size_t) [with _Val = int*, _Key = int*, _HashFcn = __gnu_cxx::hash&lt;int*&gt;, _ExtractKey = std::_Identity&lt;int*&gt;, _EqualKey = std::equal_to&lt;int*&gt;, _Alloc = std::allocator&lt;int*&gt;]'
  /usr/include/c++/4.2.1/ext/hashtable.h:437:   instantiated from 'std::pair&lt;__gnu_cxx::_Hashtable_iterator&lt;_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc&gt;, bool&gt; __gnu_cxx::hashtable&lt;_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc&gt;::insert_unique(const _Val&amp;) [with _Val = int*, _Key = int*, _HashFcn = __gnu_cxx::hash&lt;int*&gt;, _ExtractKey = std::_Identity&lt;int*&gt;, _EqualKey = std::equal_to&lt;int*&gt;, _Alloc = std::allocator&lt;int*&gt;]'
  /usr/include/c++/4.2.1/ext/hash_set:197:   instantiated from 'std::pair&lt;typename __gnu_cxx::hashtable&lt;_Value, _Value, _HashFcn, std::_Identity&lt;_Tp&gt;, _EqualKey, _Alloc&gt;::const_iterator, bool&gt; __gnu_cxx::hash_set&lt;_Value, _HashFcn, _EqualKey, _Alloc&gt;::insert(const typename __gnu_cxx::hashtable&lt;_Value, _Value, _HashFcn, std::_Identity&lt;_Tp&gt;, _EqualKey, _Alloc&gt;::value_type&amp;) [with _Value = int*, _HashFcn = __gnu_cxx::hash&lt;int*&gt;, _EqualKey = std::equal_to&lt;int*&gt;, _Alloc = std::allocator&lt;int*&gt;]'
  src/ods2.cpp:677:   instantiated from here
  </code></pre>