boost::any can contain values of any type, but you should know what it can hold in order to be able to retrieve the value, and it allocates memory on the heap for the stored value.
boost::variant, , , , , sizeof of boost::variant sizeof + , ( ).
boost::variant , . , boost::variant , boost::any, .