34 lines
390 B
C++
Executable File
34 lines
390 B
C++
Executable File
//
|
|
// Math.hpp
|
|
// amoeba
|
|
//
|
|
// Created by Timothy Prepscius on 12/30/16.
|
|
// Copyright © 2016 Timothy Prepscius. All rights reserved.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
namespace tjp::core::math {
|
|
|
|
template<typename T>
|
|
void zero(T &t)
|
|
{
|
|
t = T{0};
|
|
}
|
|
|
|
template<typename T>
|
|
T zero()
|
|
{
|
|
T t;
|
|
zero(t);
|
|
return t;
|
|
}
|
|
|
|
template<typename T>
|
|
bool is_zero(const T &t)
|
|
{
|
|
return t == zero<T>();
|
|
}
|
|
|
|
} // namespace
|