mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 02:47:16 +02:00
refactor: hello_units
fixed to provide literals
and references
preprocessor defines explicitly
This commit is contained in:
@ -28,6 +28,8 @@ analysis and unit/quantity manipulation. The basic idea and design heavily bases
|
|||||||
Here is a small example of possible operations:
|
Here is a small example of possible operations:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
#define UNITS_REFERENCES
|
||||||
|
|
||||||
#include <units/isq/si/area.h>
|
#include <units/isq/si/area.h>
|
||||||
#include <units/isq/si/frequency.h>
|
#include <units/isq/si/frequency.h>
|
||||||
#include <units/isq/si/length.h>
|
#include <units/isq/si/length.h>
|
||||||
@ -64,6 +66,9 @@ and dimensional analysis can be performed without sacrificing on accuracy. Pleas
|
|||||||
the below example for a quick preview of basic library features:
|
the below example for a quick preview of basic library features:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
#define UNITS_REFERENCES
|
||||||
|
#define UNITS_LITERALS
|
||||||
|
|
||||||
#include <units/format.h>
|
#include <units/format.h>
|
||||||
#include <units/isq/si/length.h>
|
#include <units/isq/si/length.h>
|
||||||
#include <units/isq/si/speed.h>
|
#include <units/isq/si/speed.h>
|
||||||
|
@ -3,6 +3,8 @@ Quick Start
|
|||||||
|
|
||||||
Here is a small example of possible operations::
|
Here is a small example of possible operations::
|
||||||
|
|
||||||
|
#define UNITS_REFERENCES
|
||||||
|
|
||||||
#include <units/isq/si/area.h>
|
#include <units/isq/si/area.h>
|
||||||
#include <units/isq/si/frequency.h>
|
#include <units/isq/si/frequency.h>
|
||||||
#include <units/isq/si/length.h>
|
#include <units/isq/si/length.h>
|
||||||
@ -40,6 +42,9 @@ but still easy to use interface where all unit conversions and dimensional analy
|
|||||||
performed without sacrificing on accuracy. Please see the below example for a quick preview
|
performed without sacrificing on accuracy. Please see the below example for a quick preview
|
||||||
of basic library features::
|
of basic library features::
|
||||||
|
|
||||||
|
#define UNITS_REFERENCES
|
||||||
|
#define UNITS_LITERALS
|
||||||
|
|
||||||
#include <units/format.h>
|
#include <units/format.h>
|
||||||
#include <units/isq/si/length.h>
|
#include <units/isq/si/length.h>
|
||||||
#include <units/isq/si/speed.h>
|
#include <units/isq/si/speed.h>
|
||||||
|
@ -28,7 +28,3 @@ add_subdirectory(references)
|
|||||||
|
|
||||||
add_executable(hello_units hello_units.cpp)
|
add_executable(hello_units hello_units.cpp)
|
||||||
target_link_libraries(hello_units PRIVATE mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-international)
|
target_link_libraries(hello_units PRIVATE mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-international)
|
||||||
target_compile_definitions(hello_units PRIVATE
|
|
||||||
UNITS_REFERENCES
|
|
||||||
UNITS_LITERALS
|
|
||||||
)
|
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
// SOFTWARE.
|
// SOFTWARE.
|
||||||
|
|
||||||
|
#define UNITS_REFERENCES
|
||||||
|
#define UNITS_LITERALS
|
||||||
|
|
||||||
#include <units/format.h>
|
#include <units/format.h>
|
||||||
#include <units/isq/si/international/length.h>
|
#include <units/isq/si/international/length.h>
|
||||||
#include <units/isq/si/international/speed.h> // IWYU pragma: keep
|
#include <units/isq/si/international/speed.h> // IWYU pragma: keep
|
||||||
|
Reference in New Issue
Block a user