Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As already said, you do not need to explicitly deallocate any memory here. You are not "new"ing up anything yourself. Everything will be taken care of by the destructors of the map objects.</p> <p>You could condense the update_provider function a little...</p> <pre><code>RISStorageManager::risStorageResponse update_provider(const std::string &amp;prov_id, int KeepAlive) { RISStorageManager::risStorageResponse response = (providerMap.end() == providerMap.find(prov_id)) ? risStorageCreated : risStorageUpdated; providerMap[prov_id].KeepAlive = KeepAlive; return response; } </code></pre> <p>And here is some test code to explain a couple things...</p> <pre><code>int main(int argc, char *argv []) { // Create new provider and print result... std::cout &lt;&lt; update_provider("test1", 1) &lt;&lt; std::endl; // Add a URI to the first provider for fun... providerMap["test1"].uris["www.google.com"].name = "GOOGLE"; providerMap["test1"].uris["www.google.com"].properties = 0xFF; // Create new provider and print result... std::cout &lt;&lt; update_provider("test2", 1) &lt;&lt; std::endl; // Create new provider and print result... std::cout &lt;&lt; update_provider("test3", 1) &lt;&lt; std::endl; // Update first provider and print result... std::cout &lt;&lt; update_provider("test1", 0) &lt;&lt; std::endl; // Explicitly remove first provider if you want... providerMap.erase("test1"); // // Now only 2 providers are in map (test2 and test3). // The program will exit and the STL map destructors will take care of any // memory deallocation that is needed to clean up the maps. You don't need // to explicitly clean up anything unless you want to remove providers from // your map explicitly. // return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload