Topic: How about implement a extended enumerator?


Author: unituniverse.1@gmail.com
Date: Thu, 16 May 2013 14:29:56 -0700 (PDT)
Raw View
------=_Part_98_6374069.1368739796509
Content-Type: text/plain; charset=ISO-8859-1

Actually i have still no exact model for that. What i am sure for now is
something like this:

Assuming we have the original 2 enumerators:

enum Nm1 { val_n1, val_n2, val_n3 };
enum class Nm2: unsigned short { val_n1, val_n2, val_n3 };

How about

enum NmExt1: Nm1 // The NmExt1 accepts all the Nm1's member as the member
of itself.
{
  val_n1,  // will override the original value of the member in Nm1 with
the same id.
  val_n4,  // The default value of it is Nm1::val_n3 + 1.
  val_n5 = Nm1::val_n2, // Use the constant defined in Nm1.
  val_n6 = 100 // Standard initial constant.

}; // It doesn't means that the NmExt1 'inherits' from Nm1. The type of
NmExt1 is a unique type.

and

// The NmExt1 accepts all the Nm2's member as the member of itself and with
the member category of Nm2 either.
enum NmExt2: Nm2 // The NmExt2 is actually a class enumerator.
{
  val_n1,   // will override the original value of the member in Nm2 with
the same id.
  val_nex1, // The default value of it is Nm2::val_n3 + 1.
  val_nex2, // Standard initial constant.

}; // It doesn't means that the NmExt2 'inherits' from Nm2. The type of
NmExt2 is a unique type.


enum class NmExt3: Nm1 // Ill format 1.
{ val_whatever };

enum class NmExt4: Nm2 // Ill format 2.
{ val_whatever };

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_98_6374069.1368739796509
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Actually i have still no exact model for that. What i am sure for now =
is something like this:</div><div><br></div><div>Assuming we have the origi=
nal 2 enumerators:</div><div><br></div><div>enum Nm1 { val_n1, val_n2, val_=
n3 };</div><div>enum class Nm2: unsigned short { val_n1, val_n2, val_n3 };<=
/div><div><br></div><div>How about</div><div><br></div><div>enum NmExt1: Nm=
1 // The NmExt1 accepts all the Nm1's member as the member of itself.</div>=
<div>{</div><div>&nbsp; val_n1, &nbsp;// will override the original value o=
f the member in Nm1 with the same id.</div><div>&nbsp; val_n4, &nbsp;// The=
 default value of it is Nm1::val_n3 + 1.</div><div>&nbsp; val_n5 =3D Nm1::v=
al_n2, // Use the constant defined in Nm1.</div><div>&nbsp; val_n6 =3D 100 =
// Standard initial constant.</div><div><br></div><div>}; // It doesn't mea=
ns that the NmExt1 'inherits' from Nm1. The type of NmExt1 is a unique type=
..</div><div><br></div><div>and</div><div><br></div><div>// The NmExt1 accep=
ts all the Nm2's member as the member of itself and with the member categor=
y of Nm2 either.</div><div>enum NmExt2: Nm2 // The NmExt2 is actually a cla=
ss enumerator.</div><div>{</div><div>&nbsp; val_n1, &nbsp; // will override=
 the original value of the member in Nm2 with the same id.</div><div>&nbsp;=
 val_nex1, // The default value of it is Nm2::val_n3 + 1.</div><div>&nbsp; =
val_nex2, // Standard initial constant.</div><div><br></div><div>}; // It d=
oesn't means that the NmExt2 'inherits' from Nm2. The type of NmExt2 is a u=
nique type.</div><div><br></div><div><br></div><div>enum class NmExt3: Nm1 =
// Ill format 1.</div><div>{ val_whatever };</div><div><br></div><div>enum =
class NmExt4: Nm2 // Ill format 2.</div><div>{ val_whatever };</div><div><b=
r></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_98_6374069.1368739796509--

.


Author: Lawrence Crowl <crowl@googlers.com>
Date: Thu, 16 May 2013 15:07:07 -0700
Raw View
On 5/16/13, unituniverse.1@gmail.com <unituniverse.1@gmail.com> wrote:
> Actually i have still no exact model for that. What i am sure for now is
> something like this:

What problem are you trying to solve?  Why is this mechanism a good way
to solve that problem?  (Showing us code would help.)

>
> Assuming we have the original 2 enumerators:
>
> enum Nm1 { val_n1, val_n2, val_n3 };
> enum class Nm2: unsigned short { val_n1, val_n2, val_n3 };
>
> How about
>
> enum NmExt1: Nm1 // The NmExt1 accepts all the Nm1's member as the member
> of itself.
> {
>   val_n1,  // will override the original value of the member in Nm1 with
> the same id.
>   val_n4,  // The default value of it is Nm1::val_n3 + 1.
>   val_n5 = Nm1::val_n2, // Use the constant defined in Nm1.
>   val_n6 = 100 // Standard initial constant.
>
> }; // It doesn't means that the NmExt1 'inherits' from Nm1. The type of
> NmExt1 is a unique type.
>
> and
>
> // The NmExt1 accepts all the Nm2's member as the member of itself and with
>
> the member category of Nm2 either.
> enum NmExt2: Nm2 // The NmExt2 is actually a class enumerator.
> {
>   val_n1,   // will override the original value of the member in Nm2 with
> the same id.
>   val_nex1, // The default value of it is Nm2::val_n3 + 1.
>   val_nex2, // Standard initial constant.
>
> }; // It doesn't means that the NmExt2 'inherits' from Nm2. The type of
> NmExt2 is a unique type.
>
>
> enum class NmExt3: Nm1 // Ill format 1.
> { val_whatever };
>
> enum class NmExt4: Nm2 // Ill format 2.
> { val_whatever };
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
>
>
>


--
Lawrence Crowl

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



.