How to check if object is an instance of generic class?

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 3 11:47:41 PDT 2017


On Wed, May 03, 2017 at 08:24:31PM +0200, ag0aep6g via Digitalmars-d-learn wrote:
> On 05/03/2017 08:04 PM, H. S. Teoh via Digitalmars-d-learn wrote:
> > You only need a common interface if you wish to do something more
> > with Box!X instantiations that's common across all Boxes.
> 
> The goal is to return `true` for two empty boxes with different
> payload types. From the OP: "Empty boxes are equal no matter the
> type."

Ah, I missed that part. In that case, yes, you'll need an interface with
an isEmpty() method as you described.


T

-- 
Живёшь только однажды.


More information about the Digitalmars-d-learn mailing list