I keep running into an error that no matching constructor for initialization of 'std::shared_ptr<void>'
which makes sense, but I don't know where to begin.
Here is what I'm working with.
#include <memory>
struct Container {
int type;
std::shared_ptr<void> payload;
Container(int t, const void *p) : type(t), payload(p) { }
};
int main() {
return 0;
}
I'm trying to make a generic container using a shared_ptr
with type of void
. I was going to do a switch on the type and then just cast the payload into the appropriate type.
I figured I could just do something like Container ctn(1, new Data());
but I think I might have that wrong as well.
Thanks.