F
frs
It is obviously possible to template the operator[]. But
how can one use it? Considering the following example,
how would I get something like 'a<int>[12]', assuming
'a' is of type 'A'. Is it my compiler that is too weak
(g++ 3.3.5) ?
Thanks and Regards
Frank
EXAMPLE:----------------------------------------------------------------
struct A {
template <typename T>
int operator[](const int&);
};
template <> int
operator[]<int>(const int& X)
{ return 0; }
template <> int
operator[]<double>(const int& X)
{ return 1; }
how can one use it? Considering the following example,
how would I get something like 'a<int>[12]', assuming
'a' is of type 'A'. Is it my compiler that is too weak
(g++ 3.3.5) ?
Thanks and Regards
Frank
EXAMPLE:----------------------------------------------------------------
struct A {
template <typename T>
int operator[](const int&);
};
template <> int
operator[]<int>(const int& X)
{ return 0; }
template <> int
operator[]<double>(const int& X)
{ return 1; }