Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2021-03-01 02:36:18


On 28/02/2021 6:01 am, Alexandru Onea wrote:
> My implementation defines a namespace for each tuning system. Within the
> namespaces I define base units, units and a system, as well as
> conversion factors between the systems. The base dimension is defined in
> only one of the namespaces (corresponding to the tuning system which I
> consider "standard" which is the 1200 cents per octave system).
>
> 1. Does such an approach qualify as a good approach in general (leaving
> aside the musical aspects)?

If you're wanting to have conversions between the systems, yes (see the
metric and cgs systems in Boost.Units for some examples of this).

Otherwise you can have them as completely independent systems if you
don't need to convert between them, or if the only conversions happen
"manually" outside of Boost.Units.

> 2. Is it a good practice to place all these namespaces in boost::units
> (extend boost::units)? Or should I keep them within my own namespaces?

No, you should never add your own types to any boost namespaces,
including boost::units.


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