Skip to content

Commit 8cfa98e

Browse files
committed
Use std::set for IdList.
This enforces an ordered, deterministic container for identifier lists and consolidates the type via the IdList typedef.
1 parent 472639f commit 8cfa98e

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/internaltypes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ limitations under the License.
1818

1919
#include <map>
2020
#include <set>
21-
#include <unordered_set>
2221
#include <vector>
2322

2423
#include "libcellml/component.h"
@@ -54,7 +53,7 @@ using VariablePtrs = std::vector<VariablePtr>; /**< Type definition for list of
5453

5554
using IdMap = std::map<std::string, std::pair<int, std::vector<std::string>>>; /**< Type definition for map of IDs in Validator. **/
5655
using ImportLibrary = std::map<std::string, ModelPtr>; /** Type definition for library map of imported models. */
57-
using IdList = std::unordered_set<std::string>; /**< Type definition for list of identifiers. */
56+
using IdList = std::set<std::string>; /**< Type definition for list of identifiers. */
5857

5958
using ResetOrderMap = std::map<VariablePtr, std::vector<int>>; /** Type definition for map of variable to reset order. **/
6059

src/utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ IdList listIds(const ModelPtr &model)
950950
// Collect all existing identifiers in a list and return. NB can't use a map or a set as we need to be able to print
951951
// invalid models (with duplicated identifiers) too.
952952

953-
std::unordered_set<std::string> idList;
953+
IdList idList;
954954
// Model.
955955
std::string id = model->id();
956956
if (!id.empty()) {

0 commit comments

Comments
 (0)