Topic: dynamic_switch (?)


Author: Alex Vinokur <alexander.vinokur@telrad.co.il>
Date: 1999/10/21
Raw View
Hi,

Is it worth adding to C++ dynamic_switch?

Does anything prevent from that :
        implementation problem,
        conceptual reasons?

If we could write something like this
//===============================
string sss;
string sss1 = "XXXXXXXXX";
string sss2 = "YYYYYYYYYY";
        dynamic_switch (sss)
        {
                case sss1 :
                        // Stuff
                        break;

                case sss2 :
                        // Stuff
                        break;

                default :
                        // Stuff
                        break;
        }

//-------------------
class AAA
{
        // Stuff
};
AAA aaa (...);
AAA aaa1 (...);
AAA aaa2 (...);
        dynamic_switch (aaa)
        {
                case aaa1 :
                        // Stuff
                        break;

                case aaa2 :
                        // Stuff
                        break;

                default :
                        // Stuff
                        break;
        }

//===============================
it would be nice.


If typeid and dynamic_cast are available,
        why dynamic_switch isn't?


        Alex



Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]