diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-17 23:19:11 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-18 05:33:44 +0800 |
commit | de574487e43b15184ce81e7cb9885fd1387f4964 (patch) | |
tree | 4c250148e23bbfeb595f00260b99c9836d08c9eb /Types.h | |
parent | 294648b534e294554f5ceb8467667eac3a60a3f1 (diff) | |
download | dexon-solidity-de574487e43b15184ce81e7cb9885fd1387f4964.tar.gz dexon-solidity-de574487e43b15184ce81e7cb9885fd1387f4964.tar.zst dexon-solidity-de574487e43b15184ce81e7cb9885fd1387f4964.zip |
getMemberTypes() respects source order
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -50,14 +50,16 @@ using TypePointers = std::vector<TypePointer>; class MemberList { public: - using MemberMap = std::map<std::string, TypePointer>; + using MemberMap = std::vector<std::pair<std::string, TypePointer>>; MemberList() {} explicit MemberList(MemberMap const& _members): m_memberTypes(_members) {} TypePointer getMemberType(std::string const& _name) const { - auto it = m_memberTypes.find(_name); - return it != m_memberTypes.end() ? it->second : TypePointer(); + for (auto const& it: m_memberTypes) + if (it.first == _name) + return it.second; + return TypePointer(); } MemberMap::const_iterator begin() const { return m_memberTypes.begin(); } |