I've added a few features to the class, I know these are not in the standard so I don't expect you to merge them into master but putting them here in case someone else needs them.
I think in most situations, if you're using any for storage, you don't know the type in advance so you want to check what type it is and exceptions are way too inconvenient (and slow), so I've added any_cast_test that returns a bool determining the success of the cast.
I've also adjusted any_cast to not throw an exception in case the type stored is a pointer (it returns nullptr instead).
Finally I've added an equality operator so you can test whether two different any instances contain the same data (either the same pointer or same value).
I've added a few features to the class, I know these are not in the standard so I don't expect you to merge them into master but putting them here in case someone else needs them.
I think in most situations, if you're using any for storage, you don't know the type in advance so you want to check what type it is and exceptions are way too inconvenient (and slow), so I've added
any_cast_test
that returns a bool determining the success of the cast.I've also adjusted
any_cast
to not throw an exception in case the type stored is a pointer (it returns nullptr instead).Finally I've added an equality operator so you can test whether two different
any
instances contain the same data (either the same pointer or same value).