Need to implement a container class that implements the Dictionary
interface and is able to throw an exception that implements the NotFoundException
interface. During development it is allowed to use STL
. In addition, the internal implementation is not limited by anything.
template<class TKey, class TValue>
class Dictionary
{
public:
virtual ~Dictionary() = default;
virtual const TValue& Get(const TKey& key) const = 0;
virtual void Set(const TKey& key, const TValue& value) = 0;
virtual void Remove(const TKey& key) = 0;
virtual bool IsSet(const TKey& key) const = 0;
};
template<class TKey>
class NotFoundException : public std::exception
{
public:
virtual const TKey& GetKey() const noexcept = 0;
};
Here I will provide some links to my projects for the convenience of transition to them.
-
component-sdl2
— is a small cross-platform library for creating interfaces created on the basis of the low-level graphics library SDL2. It supports the complete customization of the appearance of components usingcss
, as well as the simple creation of custom components of any complexity. -
table-winapi
— a small abstraction for tables inWinAPI
and some other things, as well as working withCSV
.
Name: Petr Makhnev
E-Mail: mr.makhneff@gmail.com
Telegram: @petr_makhnev