I would like to create a base class that will be inherited by other objects so that they can be stored in one container. This base class will contain a template method that defines the function as the setter or receiver used to access the buffer in a multi-threaded system. I want to do something like this guy, but not quite sure how to implement Linky. I would also like to be able to use a virtual function in the database and define functionality in derived classes, I know that you actually do not have a virtual template function, but there is a way to encode it in such a way that it acts as a concept of a virtual template function. Below is a rough example of how I would like the layout to be. The do_work method called through the callback. The callback is passed to the stream as an argument.
class A {
template<typename R, typename P>
virtual R do_work(P param) = 0;
}
class B : public A {
template<void,int>
R do_work(P param){ return R;}
}
class C : public A {
template<int,void>
R do_work(P param){ return R;}
}
source
share