Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Phyth::UnitRegistrar< UnitT > Struct Template Reference

Static registrar for unit types. More...

#include <UnitsRegistry.hpp>

Public Member Functions

 UnitRegistrar (const std::string &name, const std::string &symbol)
 Register the unit with the given name and symbol.
 

Detailed Description

template<typename UnitT>
struct Phyth::UnitRegistrar< UnitT >

Static registrar for unit types.

UnitRegistrar registers a unit at static initialization time, before main() is called. This allows units to be registered automatically without requiring explicit registration calls.

Template Parameters
UnitTThe unit type to register

Usage: // In a .cpp file or header (with inline): static UnitRegistrar<Meter> meterRegistrar("Meter", "m"); static UnitRegistrar<Second> secondRegistrar("Second", "s"); static UnitRegistrar<Newton> newtonRegistrar("Newton", "N");

Definition at line 122 of file UnitsRegistry.hpp.

Constructor & Destructor Documentation

◆ UnitRegistrar()

template<typename UnitT >
Phyth::UnitRegistrar< UnitT >::UnitRegistrar ( const std::string &  name,
const std::string &  symbol 
)
inline

Register the unit with the given name and symbol.

Parameters
nameFull unit name
symbolUnit symbol

Definition at line 129 of file UnitsRegistry.hpp.


The documentation for this struct was generated from the following file: