S
Steven T. Hatton
Somewhere I seem to recall an example where the author was able to access
some kind of representation of a variable's type and use it to create
another variable of the same type. It may have been in the context of
templates.
Here's why I ask; I have a member field declared like this:
protected:
vector<vector<SbVec3f*> >* strips_ptr;
Within a function, I came across a reason to want a local variable of the
same type. The alternatives are to either use the same long (painful to
type) declaration, or use a typedef. I personally dislike typedefs in most
situations. They seem like just another level of indirection with the
potential to obfuscate and confuse.
OTOH, if I can create a variable in such a way that I can see it's another
instance of one I'm already using, that seems more informative and direct.
some kind of representation of a variable's type and use it to create
another variable of the same type. It may have been in the context of
templates.
Here's why I ask; I have a member field declared like this:
protected:
vector<vector<SbVec3f*> >* strips_ptr;
Within a function, I came across a reason to want a local variable of the
same type. The alternatives are to either use the same long (painful to
type) declaration, or use a typedef. I personally dislike typedefs in most
situations. They seem like just another level of indirection with the
potential to obfuscate and confuse.
OTOH, if I can create a variable in such a way that I can see it's another
instance of one I'm already using, that seems more informative and direct.