|
Boost : |
From: David B. Held (dheld_at_[hidden])
Date: 2003-02-02 18:02:10
"Beman Dawes" <bdawes_at_[hidden]> wrote in message
news:4.3.2.7.2.20030202153034.022fcfd0_at_mailhost.esva.net...
> [...]
> In other words, there are four interface combinations:
>
> When T is not an array && conversion to T* is not desired:
>
> T& operator*() const;
> T* operator->() const;
When T is an array, is it really necessary to disable these? I can see
disabling operator->, but shouldn't operator* just return a reference
to the first element?
> [...]
> When T is an array && conversion to T* is not desired:
>
> T& operator[](size_t i) const;
>
> When T is an array && conversion to T* is desired:
>
> operator T*() const;
Trying a quick test case with both on Comeau shows that it is not
ambiguous, and a quick test with BCB shows the right operator
getting called. I guess I'm not sure why operator[] can't always
be defined for array types.
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk