Suppose I have the following class that modifies data received from another interface.
template <class T> class Updater { public: Updater(): _db(Database<T>()) { } void append(T value) { std::list<T> l = _db.get(); l.push_back(value); _db.set(l); } void remove(T value) { std::list<T> l = _db.get(); l.remove(value); _db.set(l); } private: Database<T> _db; };
So, I use this with ints and floats and the like. I get a linked list and I manipulate it.
But I will say that I want to use this class to work on the following type:
std::pair<std::string, std::shared_ptr<void>>
That is, a memory block associated with a name.
I can use the append function above, as well as add more memory to the linked list before passing it back to db. However, if I want to remove a block based on the name (the string part of the pair), I thought that I could solve this specialization problem as follows:
template <> void MultiValue<std::pair<std::string, std::shared_ptr<Block>>>::remove(std::string value) { }
But it will not compile, complaining that it is incompatible with the previous definition.
Any suggestions on how I can solve this?
source share