azist / azos

A to Z Sky Operating System / Microservice Chassis Framework
MIT License
213 stars 29 forks source link

operator overloading for PilePointer #21

Closed furesoft closed 5 years ago

furesoft commented 5 years ago

add operators to PilePointer like

!ptr dereferencing

zhabis commented 5 years ago

Would need to be on Piled, as PilePointer does not contain what pile the pointer is from

zhabis commented 5 years ago

Added binary operator & in commit c079e71:

//PilePointer.cs
public static object operator &(IPile pile, PilePointer ptr)
{
   return pile.NonNull(nameof(pile)).Get(ptr);//->     var x = pile&ptr;
}

//Usage:

//using Get
var obj = pile.Get(ptr);

//using operator
var obj = pile & ptr;