Dear all,
I am experimenting with MultiIndex, and I am happy with my custom classes.
Now I am wondering, can I index integers without a custom class?
For instance, say we have a 32 bit unsigned integer, how can I index
these with respect to the MSB or LSB? My first guess is using a union,
something like
union uint32_u
{
uint32_t data;
uint16_t bits[2];
};
// define a multiply indexed set with indices by id and name
typedef boost::multi_index::multi_index_container<
uint32_u,
boost::multi_index::indexed_by<
// sort by MSB
boost::multi_index::ordered_non_unique
integer_set;
But I cannot obviously compile it. Is there a way I can do this? Thanks!