Skip to content

A quick C++ library for making "switch" statements based on types

License

Notifications You must be signed in to change notification settings

bretthall/TypeSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeSwitch:

This library allows one to write code like:

Switch ( arg, Case( [&](const WType1& arg) { }), Case( [&](const WType2& arg) { Switch ( arg, Case( [&](const WDerivedFromType2& arg) { }), IgnoreOthers ()); }), Case( [&](const WType3& arg) { }), OneOf<WType4, WType5, WType6>( [&](const Arg& arg) { }),
Otherwise ( [&](const Arg& arg) { }));

where arg is of some base type and WType1, WType2, etc. are derived types. This avoids having have a bunch of if's and dynamic_casts spalyed all over your code.

About

A quick C++ library for making "switch" statements based on types

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages