When defining a constructor overload whose only purpose is to dereference a value I get an error that I'd like to understand.
Here's the code:
struct _tv {
string t;
void* v;
_tv(string _t, void* _v) {
t = _t;
v = _v;
};
_tv(_tv* v) { _tv(*v); }; // A
};
And it fails to compile because of:
error: redefinition of 'v'
_tv(_tv* v) { _tv(*v); };
What I want to do is to be able to construct _tv's like this:
// Suppose 'a' is a valid _tv*
_tv* b = new _tv(a); // B
If I drop that line (A) from my code, it compiles and I could achieve the same result with:
_tv* b = new _tv(*a);
But I don't want that, I want to understand why it doesn't work and why the error states that I'm trying to redefine the argument 'v'.