Boost logo

Boost :

From: remi.chateauneu_at_[hidden]
Date: 2007-05-15 05:45:49


Larry Evans a écrit :
>
>
> By blob do you mean Binary Large OBject:
>
Sorry - in fact I meant any opaque data type.
>
>> to be able to manipulate class-like objets, with the same interface as a
>> real class. ( ... maybe std::map< const std::type_info *, boost::any > ,
>> with type_info referring a class'member ? ) I agree that the concept is
>> not quite clear at the moment, but again this is related to
>> communicating data with software components which cannot be re-compiled
>> at each modification of a user's class.
>>
>
> This must be different than fusion's tuple because you mention
> boost::any, but wait, why not just use boost::any since it can
> hold any time and your wouldn't need the std::map.
>
> I must be missing somehting :(
>
I was not clear:
One of the aspects of my problem is that I wish to process all the
members of a class, in a homogeneous way, while keeping the type
information. A way to do that would be - in a way (This code does not
make sense, it is just here to explain with I try to to with CRD) :
boost::tuple< Class:Member1, Class::Member2, ... >
... with an actual 'Class' object ...
... generating a container of :
std::pair< const std::type_info *, boost::any >

Each of the boost::any object would actually store the value of a member
of the 'Class' object. But, all std::pairs have the same type which is
convenient for dynamic processing.

> The possibility to add dynamic attributes for class members, indexed
> for example by typeid (Column names in a SQL table, or specific format
> for displaying a given class member), which may change from one object
> to another of the same class.

Now that we have, for example, a std::map indexed with const
std::type_info *, we can add to it extra properties, for example fprintf
format directives, as a std::map< const std::type_info *, std::string >.
It is even possible to stack on to of boost::any, other properties based
on the template parameters: This still allows to carry type-related
information, but with the same type for all members of the class.

-

> -regards,
> Larry
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk