Re: pointer problem

From: Rob Williscroft (rtw_at_freenet.REMOVE.co.uk)
Date: 11/05/03


Date: 04 Nov 2003 23:05:04 GMT

Thomas Baier wrote in
news:3fa82cef$0$3454$9b4e6d93@newsread4.arcor-online.net:

Top Post rearranged ..

>
> Rob Williscroft wrote:
>
>> Thomas Baier wrote in news:3fa6cdb0$0$3470$9b4e6d93@newsread4.arcor-
>> online.net:
>>
>>>
>>> Works fine, but is there a way to overload the <-operator so that
>>> a<b is the same as &a<&b?
>>>
>>>
>>
>> No, at least one argument to any user defined operator must be a
>> user defined type (struct, class or union).
>>

> Hm, maybe I don't really understood what you mean, but I want to
> overload the operator of my user defined class (tree). So I've written
> something like:

Word games will not help. A pointer, be it to an inbuilt type or a UDT,
is an not a user defined type (UDT).

>
> //list.h
> template <typename T> class list {
> protected:
> //...
> T* content;
>
> public:
> //...
> void sort() {
> //...
> if(content[i]<content[i+1])

This is where you need to make the change, I showed the basic's of how
in my original response.

Eg:

    if ( example_is_less< T >( content[i], content[i+1] ) )

> //...
> }
> };
>

[snip]

>
> So do anybody now see a way to solve that problem?
>

See the my original response.

Rob.

-- 
http://www.victim-prime.dsl.pipex.com/