Electron volts with boost::units?

151 Views Asked by At

Does boost::units have an option to express energy in electron volts (eV)? I can't seem to find the right header file for that

1

There are 1 best solutions below

0
Michele Renda On

A bit late, but you can get it so:

boost::units::quantity<boost::units::si::energy> electronvolt 
   = 1. * boost::units::si::volt * boost::units::si::constants::codata::e;

(however, this is not what the user was asking: no, Boost.Units has no support for electronvolt)