Adding deprecated to an enum member

dark777 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 31 19:06:27 PDT 2017


On Tuesday, 1 August 2017 at 01:12:28 UTC, Jeremy DeHaan wrote:
> I got an error today because I added deprecated to an enum 
> member.
>
> Is there a way to achieve this, or am I out of luck? If it 
> isn't doable, should it be?
>
> Here's what I want:
>
> enum PrimitiveType
> {
>     Points,
>     Lines,
>     LineStrip,
>     Triangles,
>     TriangleStrip,
>     TriangleFan,
>     Quads,
>
>     deprecated("Use LineStrip instead.")
>     LinesStrip = LineStrip,
>     deprecated("Use TriangleStrip instead.")
>     TrianglesStrip = TriangleStrip,
>     deprecated("Use TriangleFan instead.")
>     TrianglesFan   = TriangleFan
> }
>
>
> PrimitiveType ptype = LinesStrip; //error, Use LineStrip 
> instead.

I did as follows using deprecated may help you to elucidate in 
relation to this
https://pastebin.com/NEHtWiGx


More information about the Digitalmars-d-learn mailing list