On 10/25/2011 06:24 PM, Andrew Wiley wrote:


On Tue, Oct 25, 2011 at 8:06 AM, Gor Gyolchanyan
<[email protected] <mailto:[email protected]>> 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");
}

Reply via email to