Synchronized Classes and Struct Members
Andrew Wiley
wiley.andrew.j at gmail.com
Tue Oct 25 10:06:07 PDT 2011
On Tue, Oct 25, 2011 at 11:59 AM, Timon Gehr <timon.gehr at gmx.ch> wrote:
> On 10/25/2011 06:24 PM, Andrew Wiley wrote:
>
>>
>>
>> On Tue, Oct 25, 2011 at 8:06 AM, Gor Gyolchanyan
>> <gor.f.gyolchanyan at gmail.com <mailto:gor.f.gyolchanyan@**gmail.com<gor.f.gyolchanyan at gmail.com>>>
>> wrote:
>>
>> And so you can have both thread-safe synchronized heavy-duty container
>> and a fast and small container all in one just by overloading the
>> appropriate methods and adding appropriate synchronization blocks in
>> the shared ones.
>> This is one of those "little" advantages of D over C++, that make my
>> life _SO_ much easier.
>>
>>
>> Except that overloading shared and non-shared methods is not allowed.
>>
>
> Yes it is.
>
> struct X{
> string foo(){ return "unshared"; }
> string foo()shared{ return "shared"; }
> }
>
> void main(){
> X x;
> shared X y;
> assert(x.foo() == "unshared");
> assert(y.foo() == "shared");
> }
>
Then it's been silently fixed since this was written:
http://3d.benjamin-thaut.de/?p=18
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111025/c5b19da8/attachment.html>
More information about the Digitalmars-d
mailing list