Hmmm... I thought I was pretty clear on what I''m trying to do.
I''m designing a kind of Container. It contains a specific
type of values. Whether it''s byte, int, long, float, double,
I haven''t decided yet. I want to be able to use a "typedef"
defined by the container so that I write outside code and
declare varibles of that type.
This way, when I later decide to change the type, I can do
so without changing outside code I''ve already written.
In C++, that''s extremely easy.
class MyContainer { public: typedef int value_type; std::vector<value_type> values; };// end// Outside codeMyContainer::value_type myVar = 5; // No problemMyContainer.add(myVar);
I don''t know any more elegant than that. Extremely simple
and effective. I can change "int" to "long" or "short"
without changing the outside code.
*THAT* is what I want.
If you think that''s a useless example, think OpenGL vertices.
They can be stored as GL_BYTE, GL_INT, GL_FLOAT, GL_DOUBLE..etc.
I want to test with different data types.
Why is it so hard in C#? Hmm...
And, no, I''m not asking for templates (generics). My
container will use only one specific type when I''m done.
I don''t know, wyrd, do you have a good solution to my problem?
Kami no Itte ga ore ni zettai naru!