title: c++ how to bind a general function with multiple map object and call it clear function
body: <p>My system defines multiple <code>unordered_map</code>-like data, e.g.</p>
  <pre><code>      std::unordered_map&lt; int,  int&gt;  int_map;
        std::unordered_map&lt; int,  double&gt;  double_map;
        std::unordered_map&lt; string,  string&gt;  string_map;
        std::unordered_map&lt; string,  string&gt;  string_map_2;
        ...
        std::unordered_map&lt; string, vector&lt;string&gt; &gt;  string_string_map;
        std::unordered_map&lt; string, vector&lt;string&gt; &gt;  string_string_map_2;
  </code></pre>
  <p>Each map holds different data types. These are used with a framework (written in C) that registers callback functions. The registration function (<code>register_undo_handler</code>) takes two arguments: a pointer to the callback function and data to be passed to the callback. In our case, the data is a map pointer.</p>
  <pre><code>    //register our callback function to UNDO framework
      register_undo_handler(clear_data, &amp;int_map);
      //or :
      register_undo_handler(clear_data, &amp;string_map);
  
      // this is a sketch of the callback function, which frees the map resources
      void clear_data(void *data)
      {  
         data-&gt;clear();   
      }
  </code></pre>
  <p>If an UNDO happens, the UNDO framework will call each defined callback function, e.g. <code>clear_data</code>, and pass the registered data, cast to <code>void*</code>, as the parameter like this</p>
  <pre><code>   // For each registered callback function, run with registered parameter
     (*registered_callback_func)(data); 
  </code></pre>
  <p>We want to have a single callback function that can free any map.
  Any suggestion on the implementation?</p>