$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-12-10 10:19:12
On 12/10/2005 06:55 AM, Paul Mensonides wrote:
[snip]
> I haven't really been following this conversion, but why do you need an array at
> all?  You have a sequence containing enumerator names.  You can generate a
> switch statement just as easily as you can the enum itself:
> 
> switch (v) {
>     case False:
>         return "False";
>     case True:
>         return "True";
> // etc.
> 
> Regards,
> Paul Mensonides
Hmm... An array *seems* "cleaner" or "more object-oriented".  I only
say more "object-oriented" because switch statements were used before
there were virtual functions.  However, maybe that's my prejudice, and
I'll admit "cleaner" and "more object-oriented" are pretty nebulous.
Anyway, an example of generating such a switch statement is in
vault under "Template Metaprogramming" in PP_RECFLD.zip.  The
array version of the same code is in little.funvec_.zip in
little.funvec_constcvec.cpp.