US system isolated from SI

This commit is contained in:
Mateusz Pusz
2019-12-17 12:29:19 +01:00
parent b3ea3cdc91
commit 80a13b1a94
16 changed files with 258 additions and 59 deletions
+4 -3
View File
@@ -20,8 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <units/physical/si/velocity.h>
#include <units/physical/cgs/velocity.h>
#include <units/physical/si/velocity.h>
#include <units/physical/us/velocity.h>
#include <iostream>
namespace {
@@ -96,7 +97,7 @@ void example()
// Customary Units (int)
{
using namespace units::si::literals;
using namespace units::us::literals;
constexpr Length AUTO distance = 140mi; // constructed from a UDL
constexpr si::time<si::hour, int> duration(2); // constructed from a value
@@ -112,7 +113,7 @@ void example()
// Customary Units (double)
{
using namespace units::si::literals;
using namespace units::us::literals;
constexpr Length AUTO distance = 140.mi; // constructed from a UDL
constexpr si::time<si::hour> duration(2); // constructed from a value
+2 -1
View File
@@ -21,6 +21,7 @@
// SOFTWARE.
#include <units/physical/si/velocity.h>
#include <units/physical/us/velocity.h>
#include <units/format.h>
#include <iostream>
@@ -35,7 +36,7 @@ int main()
{
using namespace si::literals;
Velocity AUTO v1 = avg_speed(220km, 2h);
Velocity AUTO v2 = avg_speed(si::length<si::mile>(140), si::time<si::hour>(2));
Velocity AUTO v2 = avg_speed(si::length<us::mile>(140), si::time<si::hour>(2));
Velocity AUTO v3 = quantity_cast<si::metre_per_second>(v2);
Velocity AUTO v4 = quantity_cast<int>(v3);