Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ map of pointers to maps
    primarykey
    data
    text
    <p>Related to a different question I have posted for which I am trying to find a solution some how - <a href="https://stackoverflow.com/questions/16577724/c-dynamic-way-to-determine-the-container-to-use">C++ dynamic way to determine the container to use</a></p> <p>Noticed similar links:</p> <p><a href="https://stackoverflow.com/questions/8641751/how-to-use-a-string-as-a-variable-name-in-c">How to use a string as a variable name in C++?</a></p> <p><a href="https://stackoverflow.com/questions/15179911/how-to-adress-variable-by-name-stored-in-another-variable-c?rq=1">How to adress variable by name stored in another variable (C++)</a></p> <p>Edited - From int to float.. </p> <p>Edit 2 - the following seems to have some solution for this at this link - but need to somehow translate for this problem at hand.. </p> <p><a href="https://stackoverflow.com/questions/12157303/how-to-create-instance-of-a-class-when-the-class-name-is-stored-in-another-varia?rq=1">How to create instance of a class when the class name is stored in another variable</a></p> <p>I have the following structure:</p> <pre><code>Class Items { float itemType; float itemPrice; Items(){}; ~Items(){}; }; typedef std::unique_ptr&lt;Items&gt; pptr; typedef std::pair&lt;float, pptr&gt; itemsRec; std::multimap&lt;float, pptr&gt; mapItems; </code></pre> <p>Need help with creating a new map of mapItems... can any one help with the syntax to create this new map of mapItems? Let's assume "A" gets derived by other means.</p> <p>Thanks</p> <pre><code>std::map&lt;string, pointer to mapItems&gt; myMap; // What's the syntax for this? myMap["A"]={create a new map - mapItems_A and assign pointer here}; </code></pre> <p>Thanks.</p> <p>Edit 3 - Still exploring options - Looks like the following link has some interesting stuff that might be helpful in my case to define the container dynamically.. Exploring further. </p> <p><a href="http://sourcemaking.com/design_patterns/factory_method/cpp/1#" rel="nofollow noreferrer">http://sourcemaking.com/design_patterns/factory_method/cpp/1#</a></p>
    singulars
    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.
 

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