fork download
  1. #pragma once
  2. #include <cstddef>
  3. //#include "PhysicsEnum.h"
  4.  
  5. enum class CalculationID : std::size_t {
  6. None,//maybe...
  7. Float8,//maybe...
  8. Float16,//maybe...
  9. Float32,//maybe...
  10. Float64,//maybe...
  11. Float80,//maybe...
  12. Meter,
  13. Speed,
  14. Gram,
  15. Newton,
  16. Metric,
  17. GravityConstant,
  18. Velocity,
  19. Second,
  20. Ampere,
  21. Kelvin,
  22. Mol,
  23. Candela
  24. };
  25.  
  26.  
  27. template<class T, CalculationID PID>
  28. class CalculationType {
  29. public:
  30. typedef CalculationID ID;
  31.  
  32. CalculationType(const T& In) :Value_(In) {}
  33.  
  34. const T& Get() {
  35. return Value_;
  36. }
  37.  
  38. const T& operator =(const T& In) {
  39. Value_ = In;
  40. return Value_;
  41. }
  42.  
  43. operator const T& () {
  44. return Value_;
  45. }
  46.  
  47. protected:
  48. T Value_ = T(0);
  49. };
  50.  
  51. template<class T> using Meter = CalculationType<T, CalculationID::Meter>;
  52. template<class T> using Speed = CalculationType<T, CalculationID::Speed>;
  53. template<class T> using Gram = CalculationType<T, CalculationID::Gram>;
  54. template<class T> using Newton = CalculationType<T, CalculationID::Newton>;
  55. template<class T> using Metric = CalculationType<T, CalculationID::Metric>;
  56. template<class T> using Gravity = CalculationType<T, CalculationID::GravityConstant>;
  57. template<class T> using Velocity= CalculationType<T, CalculationID::Velocity>;
  58. template<class T> using Second = CalculationType<T, CalculationID::Second>;
  59. template<class T> using Ampere = CalculationType<T, CalculationID::Ampere>;
  60. template<class T> using Kelvin = CalculationType<T, CalculationID::Kelvin>;
  61. template<class T> using Mol = CalculationType < T, CalculationID::Mol> ;
  62. template<class T> using Candela = CalculationType < T, CalculationID::Candela> ;
  63.  
  64. template<class T> T StrongGravityConstant = 6.67431;
  65. template<class T> T WeekGravityConstant = 6.67408;
  66. template<class T> T GravityConstantMultipler = (1.0 / 100000000000);
  67.  
  68. template<class T> T PlanckConstant_h={6.62607015e-34};
  69. template<class T> T SI_a = 9.80665;
  70.  
  71.  
  72. template<class T> T Atto = 0.000000000000000001;
  73. template<class T> T Femto = 0.000000000000001;
  74. template<class T> T Pico = 0.000000000001;
  75. template<class T> T Nano = 0.000000001;
  76. template<class T> T Micro = 0.000001;
  77. template<class T> T Milli = 0.001;
  78. template<class T> T Centi = 0.01;
  79. template<class T> T Deci = 0.1;
  80. template<class T> T Zero = 0;
  81. template<class T> T One = 1;
  82. template<class T> T Deca = 10.0;
  83. template<class T> T Hecto = 100.0;
  84. template<class T> T Kilo = 1000.0;
  85. template<class T> T Mega = 1000000.0;
  86. template<class T> T Giga = 1000000000.0;
  87. template<class T> T Tera = 1000000000000.0;
  88.  
  89. template<class T> Gram<T> OneJapanYen{ 1 };
  90. template<class T> Second<T> OneMetre{1.0/299792458.0};//光の進む速度の1/299792458
  91.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:9: warning: #pragma once in main file
 #pragma once
         ^~~~
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty