Fixed ScriptValue::mapView() for const ScriptValues.

This commit is contained in:
2024-11-20 20:19:29 +01:00
parent 71fc1686bb
commit 4be8f387dc
2 changed files with 5 additions and 2 deletions

View File

@@ -81,6 +81,9 @@ public:
template<typename TMap> template<typename TMap>
MapView(TMap& map) -> MapView<typename TMap::key_type, typename TMap::mapped_type, TMap>; MapView(TMap& map) -> MapView<typename TMap::key_type, typename TMap::mapped_type, TMap>;
template<typename TMap>
MapView(const TMap& map) -> MapView<typename TMap::key_type, const typename TMap::mapped_type, const TMap>;
// //
// public functions // public functions
// //

View File

@@ -324,10 +324,10 @@ public:
return std::get<map_t>(base_).values; return std::get<map_t>(base_).values;
} }
MapView<std::string, const concrete_t> mapView() const MIJIN_NOEXCEPT auto mapView() const MIJIN_NOEXCEPT
{ {
MIJIN_ASSERT_FATAL(isMap(), "Called iterateMap() on a non-map value."); MIJIN_ASSERT_FATAL(isMap(), "Called iterateMap() on a non-map value.");
return std::get<map_t>(base_).values; return MapView(std::get<map_t>(base_).values);
} }
}; };