#pragma once #if !defined(MIJIN_CONTAINER_MAP_VIEW_HPP_INCLUDED) #define MIJIN_CONTAINER_MAP_VIEW_HPP_INCLUDED 1 #include namespace mijin { // // public defines // // // public constants // // // public types // template> struct MapView { private: TMap& map; public: MapView() = delete; MapView(const MapView&) = default; MapView(MapView&&) noexcept = default; inline MapView(TMap& map_) : map(map_) {} MapView& operator=(const MapView&) = default; MapView& operator=(MapView&&) noexcept = default; [[nodiscard]] TValue& operator[](const TKey& key) { return at(key); } [[nodiscard]] const TValue& operator[](const TKey& key) const { return at(key); } [[nodiscard]] TValue& at(const TKey& key) { return map.at(key); } [[nodiscard]] const TValue& at(const TKey& key) const { return map.at(key); } [[nodiscard]] auto begin() const { return map.begin(); } [[nodiscard]] auto begin() { return map.begin(); } [[nodiscard]] auto end() { return map.end(); } [[nodiscard]] auto end() const { return map.end(); } }; // template typename TMap> // MapView(TMap& map) -> MapView>; template MapView(TMap& map) -> MapView; template MapView(const TMap& map) -> MapView; // // public functions // } // namespace mijin #endif // !defined(MIJIN_CONTAINER_MAP_VIEW_HPP_INCLUDED)