
1 Jan
2010
1 Jan
'10
11:54 a.m.
Andres B. wrote:
Hello, i am Andrés, i am new in the boost world and i have an idea to boost.any.
With the actual boost::any i can't do this:
boost::any any_var; int i; any_var = 10; i = 1 + any_var; double d; // d = 1.0 + any_var; // throw: bad_any_cast, because any_var is int any_var = 10.0; d = 1.0 + any_var - 3.0; // now any_var is double
Any is type erasure for any type, or rather a type that is CopyConstructible and Assignable. What you want is type erasure for a type that is Addable as well, which makes it more specific.