On Thu, 10 Feb 2011 11:38:40 -0500, spir wrote:
On 02/10/2011 01:38 PM, bearophile wrote:
Is a pair of similar staticDownCast(), staticUpCast() fit for Phobos?
But I have never needed upcast in D as of now. What are common use cases?
Aren't all upcasts static anyways?
-Steve
On 02/10/2011 01:38 PM, bearophile wrote:
Lars T. Kyllingstad:
Ok, bearophile's solution is better, because it has fewer casts.
And your solution was better because it's inside a function :-)
I forgot you can cast to void*. So here's an improved version, with some
template constraints to
On Thu, 10 Feb 2011 08:02:08 -0500, d coder wrote:
Thanks Lars and Bearophile, I will give it a try.
I understand that static downcasting is dangerous. But there are
places where efficiency is paramount and you are sure that the casting
is safe. So I wholeheartedly second your proposal to have
Thanks Lars and Bearophile, I will give it a try.
I understand that static downcasting is dangerous. But there are
places where efficiency is paramount and you are sure that the casting
is safe. So I wholeheartedly second your proposal to have the stuff in
phobos.
Regards
- Cherry
Lars T. Kyllingstad:
> Ok, bearophile's solution is better, because it has fewer casts.
And your solution was better because it's inside a function :-)
> I forgot you can cast to void*. So here's an improved version, with some
> template constraints to make sure it's only used for class types
On Thu, 10 Feb 2011 11:54:02 +, Lars T. Kyllingstad wrote:
> On Thu, 10 Feb 2011 16:44:12 +0530, d coder wrote:
>
>> Greetings All
>>
>> I have learnt that D has only one casting operator and that is 'cast'.
>> The same operator assumes different functionality depending on the
>> context in
d coder:
> I have learnt that D has only one casting operator and that is 'cast'.
> The same operator assumes different functionality depending on the
> context in which it he being used.
Walter likes this design, I presume he thinks it's simpler.
> Now I have a situation where I have to downca
On Thu, 10 Feb 2011 16:44:12 +0530, d coder wrote:
> Greetings All
>
> I have learnt that D has only one casting operator and that is 'cast'.
> The same operator assumes different functionality depending on the
> context in which it he being used.
>
> Now I have a situation where I have to downc
Greetings All
I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he being used.
Now I have a situation where I have to downcast an object and I am
sure of the objects type and thereby I am s