question on using any.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

question on using any.

Joe McCay
   Any ideas on how to store the type of an object stored in an any instance for later use in comparisons (like <, >, ==, etc)?  I don't want to store an instance of the class unless necessary.  I thought about storing a pointer to the type, but could that be used with any_cast?

like:

template<class type>
class typestuffPOD {
    typedef type value_type;
     type *datatype_;
}

   This requires knowing the type when you want to use the any_cast.


Sincerely,
Joe McCay

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: question on using any.

Alan M. Carroll
I would look at Boost.Variant and see if that would work for you. Any is designed primarily for libraries that need to carry data for clients and give it back later without having to know anything about the type.

At 08:36 PM 4/16/2006, you wrote:
>   Any ideas on how to store the type of an object stored in an any instance for later use in comparisons (like <, >, ==, etc)?  I don't want to store an instance of the class unless necessary.  I thought about storing a pointer to the type, but could that be used with any_cast?

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users