Behaviour of const KSharedPtrs
Richard Smith
kde at metafoo.co.uk
Sat Nov 13 01:29:35 GMT 2004
On Saturday 13 November 2004 00:54, Stefan Teleman wrote:
> Should the following code compile ?
>
> template<class T>
> class Foo
> {
> public:
[...]
> T* get() const { return _t; }
[...]
> };
>
> int
> main (int argc, char* argv[])
> {
> Foo<int> foo;
[...]
> foo.get() = &y;
No. You just assigned to a non-lvalue. What's your point? And how does that
relate to the fact that KDE's KSharedPtr, a smart pointer class template,
does not behave like a pointer (or like any other smart pointer
implementation I know of)?
Oh, and please don't top-post :)
--
Thanks,
Richard
More information about the kde-core-devel
mailing list