Original Post
Hi,
Wonder if anyone knows the syntax for this construct if it is possibe:
I want to write a function that accepts an object(class) that has defined the index operator: Vector3 operator[](int unsigned);
In case i am not clear, let me give an example. suppose I have a function as such:
// accepts an array, with count elemtents
// dowork() will index array using array[count];
void dowork(Vector3* array, int count);
In this above, the type Vector3* has operator[]() defined.
Incidentally, I am using boost::thread and it allows any object with operator()() defined to be supplied as the thread object. So I think this contruct is highly possible. But I do not know how.
Anybody knows how to do this?
Thanks in advance!
-------------------------------
Longer story:
I wrote a template class to access interleaved arrays sequentially using stride and starting address through the operator[].
Now I want to write a function to be able to acess this template class, but be agnostic about whether the supplied object it is a plain-old-pointer or actually a specialized "pointer".
Wonder if anyone knows the syntax for this construct if it is possibe:
I want to write a function that accepts an object(class) that has defined the index operator: Vector3 operator[](int unsigned);
In case i am not clear, let me give an example. suppose I have a function as such:
// accepts an array, with count elemtents
// dowork() will index array using array[count];
void dowork(Vector3* array, int count);
In this above, the type Vector3* has operator[]() defined.
Incidentally, I am using boost::thread and it allows any object with operator()() defined to be supplied as the thread object. So I think this contruct is highly possible. But I do not know how.
Anybody knows how to do this?
Thanks in advance!
-------------------------------
Longer story:
I wrote a template class to access interleaved arrays sequentially using stride and starting address through the operator[].
Now I want to write a function to be able to acess this template class, but be agnostic about whether the supplied object it is a plain-old-pointer or actually a specialized "pointer".