
Cliff Green wrote, On 15.12.2008 18:41:
Another query to your query - there's already dynamic_bitset, which allows bit packing to a dynamically sized buffer. What would be the main differences in your interface that would make it simpler / better than dynamic_bitset? (I can think of some immediately, but it would be good Dynamic_bitset works with bits as boolean values. The idea of packed vector is to store small integers like the range [-1;1] into 3 bits. The interface would that of the std::vector. But it would certainly be possible to provide bit fiddling operators too.
to see your ideas.) Would there be any reason not to use dynamic_bitset as an implementation detail of your container? (I.e. your proposed container is mainly a wrapper for db.) This is interesting idea. I have not thought about it before. It seems to me that splitting of values bits to store them into dynamic_bitset so that they can be recombined there again could harm performance unnecessarily.
Maybe a short synopsis of your class declaration with a few important methods might be useful.
template <typename T, size_t Bits, typename StorageUnitType = size_t, typename Allocator = std::allocator<StorageUnitType> > class packed_vector; The public interface of the class is really that of the std::vector. I have complete implementation of the idea at <http://shell.sh.cvut.cz/~wilx/repos/packed_vector/packed_vector.hxx>.
Cliff
-- VH