Opened 9 years ago

Last modified 9 years ago

#8964 new Feature Requests

operator>> missing

Reported by: pipping@… Owned by: Matthias Schabel
Milestone: To Be Determined Component: units
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

boost/units/io.hpp defines operator<< but not operator>>.

As a result, dimensionful quantities can be written but not read. This is a serious problem.

Why would I want to use Boost::Units in the first place? Because I'd like to enter dimensionful quantities into my program, then do some calculations, and have it output dimensionful quantities.

The latter (i.e. output) works. But the former (i.e. input) is restricted to hardcoded parameters in my source file. If I move the data to a config file and try to read it, I face the problem that there is no operator>>.

Change History (2)

comment:1 by Steven Watanabe, 9 years ago

Parsing units is well beyond the scope of the library. Anything that I could implement would be pretty brittle.

comment:2 by pipping@…, 9 years ago

I think Boost::Units could make working with dimensionful quantities in scientific computations a lot pleasanter than it currently is. The asymmetry that this ticket address limits its field of application significantly, however:

Ideally, I would enter dimensionful quantities into my program and have it return dimensionful quantities. Writing, thus the later, is already possible. But the former (reading) is only possible in the sense that I can hardcode quantities into my program.

If, e.g., I wanted to have my program read dimensionful quantities from a config file instead (as is advisable in 99% of all cases, I would assume), I'd find myself unable to do so. I mean no offense, but if I had known this when I had first looked at Boost::Units, I probably would not have taken a second look, because this limitation is so grave.

Note: See TracTickets for help on using tickets.