Changeset 59fb462


Ignore:
Timestamp:
Aug 7, 2024, 12:02:49 AM (3 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
f3abce9
Parents:
43ab5fb
Message:

Add code comment along the example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/CFAenum.tex

    r43ab5fb r59fb462  
    236236However, the position of the underlying representation is the order of the enumerator in the new enumeration.
    237237\begin{cfa}
    238 enum() E1 { B };                                                       
    239 enum() E2 { C, D };                                                     
    240 enum() E3 { inline E1, inline E2, D };
    241 enum() E4 { A, inline E3, E };
    242 \end{cfa}
    243 In the example above, @B@ has the position 0 in @E1@ and @E3@, but it at the position 0 in @E4@ as taking the 0 there.
    244 @C@ is at the position 0 in E2, 1 in E3 and 2 in E4. @D@ is at the position 1 in E2, 2 in E3 and 3 in E4.
     238enum() E1 { B };                                                                $\C{// B}$                                             
     239enum() E2 { C, D };                                                             $\C{// C D}$
     240enum() E3 { inline E1, inline E2, E };                  $\C{// {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C, D {\color{red}]} E}$
     241enum() E4 { A, inline E3, F};                                   $\C{// A {\color{blue}[\(_{E3}\)} {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C, D {\color{red}]} E {\color{blue}]} F }$
     242\end{cfa}
     243In the example above, @B@ has the position 0 in @E1@ and @E3@, but it at the position 1 in @E4@ as @A@ taking the 0 in @E4@.
     244@C@ is at the position 0 in @E2@, 1 in @E3@ and 2 in E4. @D@ is at the position 1 in @E2@, 2 in @E3@ and 3 in @E4@.
    245245
    246246A subtype enumeration can be casted, or implicitly converted into its supertype, with a @safe@ cost. Such conversion is an @enumeration conversion@.
Note: See TracChangeset for help on using the changeset viewer.