Lets say I have the following class which changes data received from some other 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'm using this with ints and floats and the likes. I get a linked list and I manipulate it.
But lets say I wish to use this class to work on the following type:
std::pair<std::string, std::shared_ptr<void>>
That is, a block of memory associated with a name.
I can use the append function above, as is, to append more memory to the linked list, before passing it back to the db. However, if I wish to remove a block based on a name (the string part of the pair), I thought I could solve this with a specialization as follows:
template <>
void MultiValue<std::pair<std::string, std::shared_ptr<Block>>>::remove(std::string value)
{
}
But it wont compile, complaining that is incompatible with previous definition.
Any suggestions on how I might solve this?