Full documentation is on boost site: http://boost.org/doc/html/any.html - with below modifications:
- You can not construct Any type with specific value as parameter of constructor.
Because of that I used static opCall operator as a factory for Any objects. You can use it as below:
auto v1=Any(5); auto v2=Any("Text"); auto v3=Any(); // empty Any
You can also use method assign:
auto v4=(new Any).assign(78); auto v5=(new Any).assign("Other text");
- There is no any_cast function. Instead of this function Any has a member templated function as:
auto v=Any(5); int i=v.as!(int);
- There is no bad_any_cast exception. Instead I used assertion in member function as, which is triggered in case of bad casting of Any value.