GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - njoy/DimensionalAnalysis: A compact C++ header-only library providing compile-time dimensional analysis and unit awareness

BranchesTags
Open more actions menu

Latest commit

 

History

200 Commits
200 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.travis
.travis
 
 
cmake
cmake
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.travis.yml
.travis.yml
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
appveyor.yml
appveyor.yml
 
 

Repository files navigation

Dimwits

...or DIMensional analysis With unITS is a C++14 library for compile-time dimensional analysis and unit awareness.

Minimal Example

#include <iostream>
#include "dimwits.hpp"

using namespace dimwits;

int main(){

/* quantities play nicely with auto */
auto myVelocity = 1.0 * meter / second;
std::cout << "The speed is: " << myVelocity << std::endl;

/* quantities are constexpr friendly */
constexpr Quantity< Inch > myLength = 1.0 * meter;
std::cout << "1 meter in inches is: " << myLength << std::endl;

/* quantities of the same dimensionality can be implicitly converted
 * (conversions are also constexpr friendly) */
constexpr Quantity< Foot > otherLength = myLength;
std::cout << "1 meter in feet is: " << otherLength << std::endl;

/* si-prefixes can be specified on either side of the assignment */
Quantity< Kilo<Gram> > myMass = 1.0 * mega(tonne);
std::cout << "1 megatonne in kilograms is: " << myMass << std::endl;

/* NIST values for common physical constants are provided */
std::cout << "The speed of light is: " << constant::lightSpeed << std::endl;

}

This example has the following output:

The speed is:  1 s^-1 m
1 meter in inches is:  39.3701 in
1 meter in feet is:  3.28084 ft
1 megatonne in kilograms is:  1e+09 kg
The speed of light is:  2.99792e+08 s^-1 m

About

A compact C++ header-only library providing compile-time dimensional analysis and unit awareness

Topics

dimensional-analysis

Resources

Readme
License
Activity
Custom properties

Stars

10 stars

Watchers

8 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.