- Should GeneralizedLocation in universe/Pathfinder.cpp accept std::shared_ptr by value? It doesn't looks like it takes ownership on this parameter.
- GeneralizedLocation outputs simple error to log if object is very wrong but actually it foreshadows segfaults. When I fixed segfault I also fix this error. Should GeneralizedLocation throw exception instead of logging error?
- m_existing maps aren't specialized by type but appropriate main objects' maps are. Is it intended?
- m_existing maps don't require to own objects because those objects are owned by appropriate main objects' maps. What if use std::weak_ptr?
- I suppose in possible to change boost::remove_const<T>::type to std::remove_const<T>::type as the game uses c++11.
Some questing about UniverseObject usage
Moderators: Committer, Committer
Some questing about UniverseObject usage
When I worked on https://github.com/freeorion/freeorion/issues/1897 I got some question about code to discuss:
Gentoo Linux x64, gcc-9.2, boost-1.71.0
Ubuntu Server 18.04 x64, gcc-7.4, boost-1.65.1
Welcome to slow multiplayer game at freeorion-lt.dedyn.io. Version 2019-12-03.c0eb3bb.
Donates are welcome: BTC:14XLekD9ifwqLtZX4iteepvbLQNYVG87zK
Ubuntu Server 18.04 x64, gcc-7.4, boost-1.65.1
Welcome to slow multiplayer game at freeorion-lt.dedyn.io. Version 2019-12-03.c0eb3bb.
Donates are welcome: BTC:14XLekD9ifwqLtZX4iteepvbLQNYVG87zK
- Geoff the Medio
- Programming, Design, Admin
- Posts: 12478
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Some questing about UniverseObject usage
Could pass by const reference.
Probably. The main typed object maps are used to look up objects of a particular type and return a pointer of that type. The existing object lists aren't used like that so don't need to store more specialized UniverseObject pointers. That might be a circular rationale, though if they don't need to be specialized, then should they be?m_existing maps aren't specialized by type but appropriate main objects' maps are. Is it intended?
Seems like unnecessary overhead to convert the pointers. Aren't the sets maintained simultaneously anyway?m_existing maps don't require to own objects because those objects are owned by appropriate main objects' maps. What if use std::weak_ptr?
Sounds reasonable.change boost::remove_const<T>::type to std::remove_const<T>::type as the game uses c++11.