|
Boost Users : |
Subject: [Boost-users] Nstate: dynamic_bitset generalized for bounded integer values?
From: Hostile Fork (hostilefork_at_[hidden])
Date: 2009-03-05 23:18:56
Hello boost-users!
I've written a class in the same spirit as the dynamic_bitset. But
instead of being restricted to inserting values that range [0..1], the
packed values can range from [0..radix-1]. Nothing that fancy, but a
few people on #boost IRC thought it looked potentially useful, so I
decided to try announcing it here. The library is called "Nstate",
and is released under the boost software license (of course!)
http://hostilefork.com/nstate/
As an example, I point out that it can fit 20 "Tristates" (a.k.a.
Nstate<3>) into 32 bits, as opposed to 20 bytes (if one used a packing
approach with 2 bits per tristate, you would only get 16 of them out
of 32 bits).
I'm guessing this would be low on the radar in terms of getting vetted
for inclusion in boost. But if anyone out there is looking for
something *like* this, here's a start. I'd certainly appreciate any
peer review or wisdom to help make it better, faster,
smarter...boostier? So if you're bored and just like making free
libraries have more "Quality" then please send feedback! Files are:
http://github.com/hostilefork/nocycle/blob/master/Nstate.hpp
http://github.com/hostilefork/nocycle/blob/master/Nstate.cpp
Regards,
Brian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net