Skip to content

Commit

Permalink
fix: json gcc runtime error (#1301)
Browse files Browse the repository at this point in the history
I was facing a runtime error at https://github.com/acts-project/acts/blob/main/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp#L110

after applying the changes everything is back to normal

looks like a problem with gcc and nlohmann/json?

```
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
```
  • Loading branch information
andiwand authored Jul 6, 2022
1 parent d3bddc9 commit 695d9e2
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class GeometryHierarchyMapJsonConverter {
Container fromJson(const nlohmann::json& encoded) const;

private:
static constexpr const char* const kHeaderKey = "acts-geometry-hierarchy-map";
static constexpr const char* const kEntriesKey = "entries";
static constexpr const char* kHeaderKey = "acts-geometry-hierarchy-map";
static constexpr const char* kEntriesKey = "entries";
/// The version of the encoded Json container format. This must be increased
/// manually everytime the container format changes.
static constexpr int kFormatVersion = 0;
Expand Down Expand Up @@ -107,10 +107,9 @@ nlohmann::json GeometryHierarchyMapJsonConverter<value_t>::toJson(
const Container& container) const {
// encode header
nlohmann::json encoded = nlohmann::json::object();
encoded[kHeaderKey] = {
{"format-version", kFormatVersion},
{"value-identifier", m_valueIdentifier},
};
encoded[kHeaderKey] = nlohmann::json::object();
encoded[kHeaderKey]["format-version"] = kFormatVersion;
encoded[kHeaderKey]["value-identifier"] = m_valueIdentifier;
// encode entries
nlohmann::json entries = nlohmann::json::array();
for (std::size_t i = 0; i < container.size(); ++i) {
Expand Down

0 comments on commit 695d9e2

Please sign in to comment.