mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
refactor(example): small refactoring of examples
This commit is contained in:
@ -40,7 +40,7 @@ int main()
|
|||||||
constexpr auto R = isq::resistance(4.7 * si::kilo<si::ohm>);
|
constexpr auto R = isq::resistance(4.7 * si::kilo<si::ohm>);
|
||||||
|
|
||||||
for (auto t = 0 * ms; t <= 50 * ms; ++t) {
|
for (auto t = 0 * ms; t <= 50 * ms; ++t) {
|
||||||
const QuantityOf<isq::voltage> auto Vt = V0 * exp(-t / (R * C));
|
const QuantityOf<isq::voltage> auto Vt = V0 * exp(dimensionless(-t / (R * C)));
|
||||||
|
|
||||||
std::cout << "at " << t << " voltage is ";
|
std::cout << "at " << t << " voltage is ";
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template<class T>
|
template<typename T>
|
||||||
class measurement {
|
class measurement {
|
||||||
public:
|
public:
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
|
||||||
measurement() = default;
|
measurement() = default;
|
||||||
|
|
||||||
constexpr explicit measurement(const value_type& val, const value_type& err = {}) : value_(val)
|
constexpr explicit measurement(value_type val, const value_type& err = {}) : value_(std::move(val))
|
||||||
{
|
{
|
||||||
// it sucks that using declaration cannot be provided for a constructor initializer list
|
// it sucks that using declaration cannot be provided for a constructor initializer list
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
Reference in New Issue
Block a user