From: ÑÑÑÑÐ°Ð¼ Ð°Ð±Ð´ÑÐ¼Ð°Ð»Ð¸ÐºÐ¾Ð² (vigosslive2_at_[hidden])
Date: 2019-11-08 16:36:40
I wrote a library *eswitch* which provides enhanced functionality for* C++
Please take a look and leave your comments.
To overcome "*native switch*" limitations:
- one parameter per "*native switch*"
- the parameter restricted to only *integral *types( int, char, enum ... ).
"*eswitch*" supports any number of parameters and almost without
restriction on their *type*,
as long as the *type *is comparable( i.e. has* operator==* ).
*=====================Why it is important?=====================*
Here is the most viewed questions on the *stackoverflow*:
Multiple conditions in switch case
Switch for string
Case match in range
Over a million views indicate how many people out there are disappointed
with limited functionality of "*native switch*".
Building parallels with such operators as "*if*"/"*while*"... it is
expected by default that "*native switch*" should have the same
- be able to work with *non-integral* types as well
- be able to compose complex conditions like we do in other operators "
Unfortunately it is not the case up till now. There was a proposal in
about importance of this topic. There also was *StringSwitch
implementation by *LLVM
*and *Case ranges
extension which is supported by *gcc*, *intel C/C++* and *clang*.
Nevertheless, we still don't have common and universal solution. People
want to overcome current "*native switch*" limitation either by implementing
their own solution, non-standard extension or even trying to standardize
Making proposed *eswitch <https://github.com/rabdumalikov/eswitch_v4>*
part of the *Boost-Library *will provide millions of developers useful,
universal and agile functionality in order to finally fulfill their needs.
*=====================References:=====================/// "switch for
non-integral" on stackoverflow*
*/// "Multiple conditions" on stackoverflow*
*/// "Ranges in case" on stackoverflow*
*/// "Case ranges" - non-standard extension*
*/// LLVM "StringSwitch"*
*/// "Relax switch statement" proposal*
*/// "N3627 Relaxed switch statement" c++ committee status*
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk