hi guys,
have you ever tried to create a type-cast operator to a
'reference/pointer to an array'? i hadn't, not until yesterday when i
discovered that it is not exactly the trivial task one'd assume it to
be - none of my apparently naive attempts were accepted for a valid
type-cast operator by any of the compilers i threw them at (i.e. gcc
2.95.3, gcc 3.3.3, vc 2003).
so assume we have:
template < unsigned T >
class A
{
float m[T];
};
which we want to be able to cast to the data type of its sole data
member m. a supposedly correct way would be a member operator:
operator const float (& () const)[T];
which unfortunately ended up in a bunch of syntax errors on all
compilers tested; then the 'out of ideas' attempt:
oprator const float (&)[T] () const;
just got me accused (and rightfully so) of trying to declare an
operator as an array of functions.
so please tell me i was being stupid and i missed something obvious
here.
regards
martin 'blu' krastev