I'd like to get this in, unless there's some objections. Who curates the units library? ----- Original Message -----
----- Original Message -----
Link to PR: https://github.com/boostorg/units/pull/3
Description: Adds unit definitions for standard units of information: bit, byte, nat, hartley, shannon. Defines a new unit system boost::units::information for convenient manipulation. Also includes IEC binary prefixes: kibi, mebi, gibi, tebi, pebi, exbi
Example code: https://github.com/erikerlandson/units/blob/info_units/example/information.c...
Unit testing code: https://github.com/erikerlandson/units/blob/info_units/test/test_information...
In the interest of describing a use case, the reason I found myself wanting this was that for my ongoing edit_distance() project, I want to allow a user to specify a memory limit for the computation. Boost.Units is a nice vehicle for that, since it allows a user to:
(a) specify a memory limit in whatever units and scale they choose, e.g. (10 * si::mega * bytes) or (1 * si::giga * bytes), etc. (b) be unambiguous that it is a quantity of memory, as opposed to some generic numeric value.
Contrast with typical solutions that say things like "supply an integer that represents the memory limit, in megabytes"
I also intend to support time limits on the computation, and so by the same logic my plan is to allow the user to supply a time limit using a Boost.Units time quantity, in any supported unit based on time_dimension.
Obviously, units of information could support other kinds of use, e.g. applying units to entropies, as in the example code.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost