Timeline for unique_ptr usage too unwieldy
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 30, 2013 at 7:30 | vote | accept | IAE | ||
Apr 3, 2013 at 1:58 | comment | added | Yuushi | I think in this case there isn't all that much you can do. Unfortunately, C++ syntax is not concise at the best of times. The code is ugly, true, but it's not too hard to understand what is going on. | |
Apr 1, 2013 at 9:44 | comment | added | IAE | I added some more information based on the assumptions you made and further snippets I thought to be illuminating. | |
Apr 1, 2013 at 9:31 | comment | added | IAE |
Thank you for your input! You are correct with almost all assumptions, except that EntityDatabase and, by extension, ItemDatabase are static. My first approach was exactly to declare armor_ as Armor* . I did this because I wanted to constrain the types of items that could act as armor or weapons, even though they are items. I'm inclined to agree that this is an abuse of polymorphism, but aside from declaring Weapon and Armor not a derivative of Item , I didn't and don't know how to otherwise solve it.
|
|
Apr 1, 2013 at 7:40 | history | answered | Yuushi | CC BY-SA 3.0 |