Skip to content

martinnobis/frequency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frequency

Add type safety to your frequency calculations.

Installing

Single header file, simply download and include it:

#include "frequency.h"

Usage

Inspired by the std::chrono::duration class:

frequency<Hz> f1 {5};               // 5 Hz
frequency<KHz> f2 {5};              // 5 KHz

// the smallest unit is inferred:
auto f3 = f1 + f2;                  // 5505.5 Hz

f1 += f2;                           // 5005 Hz
f2 += f1;                           // 10.005 kHz

Compatability

Requires C++11.

Running the tests

Ensure that you have at least cmake 3.1.0 installed.

mkdir build
cd build
cmake ../
make
./frequency

License

MIT-licensed. See LICENSE.

About

Type safe frequency units class.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published