diff --git a/conanfile.py b/conanfile.py index 59b731c2..339ef912 100644 --- a/conanfile.py +++ b/conanfile.py @@ -56,6 +56,7 @@ class MPUnitsConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "cxx_modules": [True, False], + "import_std": [True, False], "std_format": [True, False], "string_view_ret": [True, False], "no_crtp": [True, False], @@ -64,6 +65,7 @@ class MPUnitsConan(ConanFile): } default_options = { # "cxx_modules" default set in config_options() + # "import_std" default set in config_options() # "std_format" default set in config_options() # "string_view_ret" default set in config_options() # "no_crtp" default set in config_options() @@ -108,6 +110,10 @@ class MPUnitsConan(ConanFile): "min_cppstd": "20", "compiler": {"gcc": "", "clang": "17", "apple-clang": "", "msvc": ""}, }, + "import_std": { + "min_cppstd": "23", + "compiler": {"gcc": "", "clang": "18", "apple-clang": "", "msvc": ""}, + }, "static_constexpr_vars_in_constexpr_func": { "min_cppstd": "23", "compiler": {"gcc": "13", "clang": "17", "apple-clang": "", "msvc": ""}, @@ -128,6 +134,7 @@ class MPUnitsConan(ConanFile): return { "std_format": "std_format", "cxx_modules": "cxx_modules", + "import_std": "import_std", "string_view_ret": "static_constexpr_vars_in_constexpr_func", "no_crtp": "explicit_this", } @@ -210,7 +217,7 @@ class MPUnitsConan(ConanFile): self.requires("fmt/11.0.1") def build_requirements(self): - self.tool_requires("cmake/[>=3.29 <4]") + self.tool_requires("cmake/[>=3.30 <4]") if self._build_all: if not self.options.freestanding: self.test_requires("catch2/3.6.0") @@ -226,6 +233,16 @@ class MPUnitsConan(ConanFile): raise ConanInvalidConfiguration( "'contracts' should be set to 'none' for a freestanding build" ) + # mixing of `import std;` and regular header files includes does not work for now + if self.options.import_std: + if self.options.contracts != "none": + raise ConanInvalidConfiguration( + "'contracts' should be set to 'none' to use `import std;`" + ) + if not self.options.std_format: + raise ConanInvalidConfiguration( + "'std_format' should be enabled to use `import std;`" + ) def layout(self): cmake_layout(self) @@ -242,6 +259,12 @@ class MPUnitsConan(ConanFile): if self.options.cxx_modules: tc.cache_variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True + if self.options.import_std: + tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True + # Current experimental support according to `Help/dev/experimental.rst` + tc.cache_variables[ + "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD" + ] = "0e5b6991-d74f-4b3d-a41c-cf096e0b2508" if self.options.freestanding: tc.cache_variables["MP_UNITS_API_FREESTANDING"] = True else: diff --git a/docs/getting_started/installation_and_usage.md b/docs/getting_started/installation_and_usage.md index eb283fdc..e93d3304 100644 --- a/docs/getting_started/installation_and_usage.md +++ b/docs/getting_started/installation_and_usage.md @@ -237,6 +237,14 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} [conan C++ modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 +[`import_std`](#import_std){ #import_std } + +: [:octicons-tag-24: 2.3.0][conan import std support] · :octicons-milestone-24: `True`/`False` (Default: automatically determined from settings) + + Enables `import std;` usage. + + [conan import std support]: https://github.com/mpusz/mp-units/releases/tag/v2.3.0 + [`std_format`](#std_format){ #std_format } : [:octicons-tag-24: 2.2.0][conan std::format support] · :octicons-milestone-24: `True`/`False` (Default: automatically determined from settings) @@ -338,7 +346,14 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} Adds C++ modules to the list of default targets. - [build_cxx_modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 + +[`MP_UNITS_BUILD_IMPORT_STD`](#MP_UNITS_BUILD_IMPORT_STD){ #MP_UNITS_BUILD_IMPORT_STD } + +: [:octicons-tag-24: 2.3.0][cmake import std support] · :octicons-milestone-24: `ON`/`OFF` (Default: `OFF`) + + Enables `import std;` usage. + + [cmake import std support]: https://github.com/mpusz/mp-units/releases/tag/v2.3.0 [`MP_UNITS_API_STD_FORMAT`](#MP_UNITS_API_STD_FORMAT){ #MP_UNITS_API_STD_FORMAT } diff --git a/example/avg_speed.cpp b/example/avg_speed.cpp index 70907a8a..dc2d24d2 100644 --- a/example/avg_speed.cpp +++ b/example/avg_speed.cpp @@ -25,8 +25,12 @@ // !!! renders correctly in the documentation "Examples" section. !!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/capacitor_time_curve.cpp b/example/capacitor_time_curve.cpp index 30ccdd42..4cf363fe 100644 --- a/example/capacitor_time_curve.cpp +++ b/example/capacitor_time_curve.cpp @@ -20,7 +20,11 @@ physical_quantities */ +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/clcpp_response.cpp b/example/clcpp_response.cpp index a1f252ad..42ed6d0b 100644 --- a/example/clcpp_response.cpp +++ b/example/clcpp_response.cpp @@ -17,7 +17,11 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/conversion_factor.cpp b/example/conversion_factor.cpp index cc5ff291..af80465b 100644 --- a/example/conversion_factor.cpp +++ b/example/conversion_factor.cpp @@ -17,9 +17,13 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/currency.cpp b/example/currency.cpp index b34fdc40..6f280659 100644 --- a/example/currency.cpp +++ b/example/currency.cpp @@ -21,11 +21,15 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units.core; #else diff --git a/example/foot_pound_second.cpp b/example/foot_pound_second.cpp index 2bb1e7d0..6d93b34e 100644 --- a/example/foot_pound_second.cpp +++ b/example/foot_pound_second.cpp @@ -22,9 +22,13 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/glide_computer.cpp b/example/glide_computer.cpp index e263d149..133a7713 100644 --- a/example/glide_computer.cpp +++ b/example/glide_computer.cpp @@ -25,6 +25,9 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -33,6 +36,7 @@ #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/glide_computer_lib/glide_computer_lib.cpp b/example/glide_computer_lib/glide_computer_lib.cpp index 6342a905..fcefe081 100644 --- a/example/glide_computer_lib/glide_computer_lib.cpp +++ b/example/glide_computer_lib/glide_computer_lib.cpp @@ -22,10 +22,14 @@ #include "glide_computer_lib.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units.core; #else diff --git a/example/glide_computer_lib/include/glide_computer_lib.h b/example/glide_computer_lib/include/glide_computer_lib.h index 8f26bb4c..5e2ac4db 100644 --- a/example/glide_computer_lib/include/glide_computer_lib.h +++ b/example/glide_computer_lib/include/glide_computer_lib.h @@ -25,6 +25,9 @@ #include // #include "geographic.h" +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -35,6 +38,7 @@ #include #include // IWYU pragma: keep #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/hello_units.cpp b/example/hello_units.cpp index f11f8a3a..e635bc25 100644 --- a/example/hello_units.cpp +++ b/example/hello_units.cpp @@ -27,8 +27,12 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/include/geographic.h b/example/include/geographic.h index accda550..ba26b3f1 100644 --- a/example/include/geographic.h +++ b/example/include/geographic.h @@ -25,10 +25,14 @@ #include "ranged_representation.h" #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/include/ranged_representation.h b/example/include/ranged_representation.h index 350a3b04..67557624 100644 --- a/example/include/ranged_representation.h +++ b/example/include/ranged_representation.h @@ -26,9 +26,13 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units.core; #else diff --git a/example/include/validated_type.h b/example/include/validated_type.h index f4df44b2..efc1d946 100644 --- a/example/include/validated_type.h +++ b/example/include/validated_type.h @@ -26,9 +26,13 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units.core; #else diff --git a/example/kalman_filter/kalman.h b/example/kalman_filter/kalman.h index 501dd2cc..6e629477 100644 --- a/example/kalman_filter/kalman.h +++ b/example/kalman_filter/kalman.h @@ -24,9 +24,13 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_1.cpp b/example/kalman_filter/kalman_filter-example_1.cpp index da718a98..b6cd0e12 100644 --- a/example/kalman_filter/kalman_filter-example_1.cpp +++ b/example/kalman_filter/kalman_filter-example_1.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_2.cpp b/example/kalman_filter/kalman_filter-example_2.cpp index a291813f..daec350c 100644 --- a/example/kalman_filter/kalman_filter-example_2.cpp +++ b/example/kalman_filter/kalman_filter-example_2.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_3.cpp b/example/kalman_filter/kalman_filter-example_3.cpp index a69c39e6..2e51cba1 100644 --- a/example/kalman_filter/kalman_filter-example_3.cpp +++ b/example/kalman_filter/kalman_filter-example_3.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_4.cpp b/example/kalman_filter/kalman_filter-example_4.cpp index b04ae971..f4df77a5 100644 --- a/example/kalman_filter/kalman_filter-example_4.cpp +++ b/example/kalman_filter/kalman_filter-example_4.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_5.cpp b/example/kalman_filter/kalman_filter-example_5.cpp index d12a22fe..b6071b27 100644 --- a/example/kalman_filter/kalman_filter-example_5.cpp +++ b/example/kalman_filter/kalman_filter-example_5.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_6.cpp b/example/kalman_filter/kalman_filter-example_6.cpp index a5c29d8e..93a4d0f9 100644 --- a/example/kalman_filter/kalman_filter-example_6.cpp +++ b/example/kalman_filter/kalman_filter-example_6.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_7.cpp b/example/kalman_filter/kalman_filter-example_7.cpp index 23ad51d4..d4acad8b 100644 --- a/example/kalman_filter/kalman_filter-example_7.cpp +++ b/example/kalman_filter/kalman_filter-example_7.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/kalman_filter/kalman_filter-example_8.cpp b/example/kalman_filter/kalman_filter-example_8.cpp index adfc56e2..c3b37fd7 100644 --- a/example/kalman_filter/kalman_filter-example_8.cpp +++ b/example/kalman_filter/kalman_filter-example_8.cpp @@ -22,8 +22,12 @@ #include "kalman.h" #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/measurement.cpp b/example/measurement.cpp index d8bd2297..5e1e5419 100644 --- a/example/measurement.cpp +++ b/example/measurement.cpp @@ -22,11 +22,15 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include // IWYU pragma: export #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/si_constants.cpp b/example/si_constants.cpp index 56b016a8..022003f9 100644 --- a/example/si_constants.cpp +++ b/example/si_constants.cpp @@ -27,7 +27,11 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/spectroscopy_units.cpp b/example/spectroscopy_units.cpp index e8fa0cfb..3fce6a8b 100644 --- a/example/spectroscopy_units.cpp +++ b/example/spectroscopy_units.cpp @@ -22,8 +22,12 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/storage_tank.cpp b/example/storage_tank.cpp index 7e004cf0..ad9f7580 100644 --- a/example/storage_tank.cpp +++ b/example/storage_tank.cpp @@ -23,10 +23,14 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/strong_angular_quantities.cpp b/example/strong_angular_quantities.cpp index 58ee1e2e..6487860d 100644 --- a/example/strong_angular_quantities.cpp +++ b/example/strong_angular_quantities.cpp @@ -20,7 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/total_energy.cpp b/example/total_energy.cpp index 63f26f44..bcd149d6 100644 --- a/example/total_energy.cpp +++ b/example/total_energy.cpp @@ -20,8 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/example/unmanned_aerial_vehicle.cpp b/example/unmanned_aerial_vehicle.cpp index cfb81092..3e26ac08 100644 --- a/example/unmanned_aerial_vehicle.cpp +++ b/example/unmanned_aerial_vehicle.cpp @@ -25,9 +25,13 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 675918ac..c3fffafc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,9 +38,11 @@ check_libcxx_in_use(${projectPrefix}LIBCXX) # project build options option(${projectPrefix}BUILD_AS_SYSTEM_HEADERS "Exports library as system headers" OFF) option(${projectPrefix}BUILD_CXX_MODULES "Add C++ modules to the list of default targets" OFF) +option(${projectPrefix}BUILD_IMPORT_STD "Enable `import std;` usage" OFF) message(STATUS "${projectPrefix}BUILD_AS_SYSTEM_HEADERS: ${${projectPrefix}BUILD_AS_SYSTEM_HEADERS}") message(STATUS "${projectPrefix}BUILD_CXX_MODULES: ${${projectPrefix}BUILD_CXX_MODULES}") +message(STATUS "${projectPrefix}BUILD_IMPORT_STD: ${${projectPrefix}BUILD_IMPORT_STD}") if(${projectPrefix}BUILD_AS_SYSTEM_HEADERS) set(${projectPrefix}_AS_SYSTEM SYSTEM) @@ -124,6 +126,15 @@ else() set(${projectPrefix}TARGET_SCOPE "INTERFACE") endif() +if(${projectPrefix}BUILD_CXX_MODULES) + if(CMAKE_VERSION VERSION_LESS "3.30") + message(FATAL_ERROR "CMake versions before 3.30 do not support `import std;` properly") + endif() + if(CMAKE_CXX_STANDARD LESS 23) + message(FATAL_ERROR "`import std;` requires at lease C++23") + endif() +endif() + # components/modules include(MPUnitsContracts) add_subdirectory(core) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ce9b96fd..611bfcc7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -125,6 +125,14 @@ if(${projectPrefix}BUILD_CXX_MODULES) endif() endif() +if(${projectPrefix}BUILD_IMPORT_STD) + target_compile_definitions(mp-units-core PUBLIC ${projectPrefix}IMPORT_STD) + # https://github.com/llvm/llvm-project/issues/75057 + if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + target_compile_options(mp-units-core PUBLIC "-Wno-deprecated-declarations") + endif() +endif() + # UTF-8 source and execution character set if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options( diff --git a/src/core/include/mp-units/bits/core_gmf.h b/src/core/include/mp-units/bits/core_gmf.h index c920c6ae..3f295343 100644 --- a/src/core/include/mp-units/bits/core_gmf.h +++ b/src/core/include/mp-units/bits/core_gmf.h @@ -43,6 +43,9 @@ #include #include #include +#if __cpp_lib_text_encoding +#include +#endif #if MP_UNITS_HOSTED #include @@ -53,7 +56,3 @@ #include #include #endif - -#if __cpp_lib_text_encoding -#include -#endif diff --git a/src/core/include/mp-units/bits/fmt.h b/src/core/include/mp-units/bits/fmt.h index eee5622a..c4572a9c 100644 --- a/src/core/include/mp-units/bits/fmt.h +++ b/src/core/include/mp-units/bits/fmt.h @@ -37,12 +37,16 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #include #endif +#endif // most of the below code is based on/copied from fmtlib diff --git a/src/core/include/mp-units/bits/ratio.h b/src/core/include/mp-units/bits/ratio.h index 85e49afc..329f5106 100644 --- a/src/core/include/mp-units/bits/ratio.h +++ b/src/core/include/mp-units/bits/ratio.h @@ -28,10 +28,14 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #include #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/bits/text_tools.h b/src/core/include/mp-units/bits/text_tools.h index c79ff946..a01eb4a7 100644 --- a/src/core/include/mp-units/bits/text_tools.h +++ b/src/core/include/mp-units/bits/text_tools.h @@ -29,8 +29,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/bits/type_list.h b/src/core/include/mp-units/bits/type_list.h index a15a673c..203326c6 100644 --- a/src/core/include/mp-units/bits/type_list.h +++ b/src/core/include/mp-units/bits/type_list.h @@ -25,10 +25,14 @@ #include // IWYU pragma: keep #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #endif +#endif MP_UNITS_DIAGNOSTIC_PUSH MP_UNITS_DIAGNOSTIC_IGNORE_EXPR_ALWAYS_TF diff --git a/src/core/include/mp-units/ext/algorithm.h b/src/core/include/mp-units/ext/algorithm.h index 6c50dedc..564000ac 100644 --- a/src/core/include/mp-units/ext/algorithm.h +++ b/src/core/include/mp-units/ext/algorithm.h @@ -29,10 +29,14 @@ #include // IWYU pragma: keep #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/ext/fixed_string.h b/src/core/include/mp-units/ext/fixed_string.h index 2bcc45e0..0fde61ed 100644 --- a/src/core/include/mp-units/ext/fixed_string.h +++ b/src/core/include/mp-units/ext/fixed_string.h @@ -33,17 +33,24 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #include #include #include #include #include +#endif // MP_UNITS_IMPORT_STD + #if MP_UNITS_HOSTED #include +#ifndef MP_UNITS_IMPORT_STD #include #endif -#endif +#endif // MP_UNITS_HOSTED +#endif // MP_UNITS_IN_MODULE_INTERFACE MP_UNITS_EXPORT namespace mp_units { diff --git a/src/core/include/mp-units/ext/format.h b/src/core/include/mp-units/ext/format.h index 72aca3a9..382d02a5 100644 --- a/src/core/include/mp-units/ext/format.h +++ b/src/core/include/mp-units/ext/format.h @@ -36,7 +36,11 @@ MP_UNITS_DIAGNOSTIC_IGNORE_SHADOW #include MP_UNITS_DIAGNOSTIC_POP #else +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif #endif diff --git a/src/core/include/mp-units/ext/inplace_vector.h b/src/core/include/mp-units/ext/inplace_vector.h index 02682bcd..1e93caf4 100644 --- a/src/core/include/mp-units/ext/inplace_vector.h +++ b/src/core/include/mp-units/ext/inplace_vector.h @@ -28,10 +28,14 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #endif +#endif // NOLINTBEGIN(*-avoid-c-arrays) #pragma once diff --git a/src/core/include/mp-units/ext/prime.h b/src/core/include/mp-units/ext/prime.h index 31d4f2cc..5b372fe9 100644 --- a/src/core/include/mp-units/ext/prime.h +++ b/src/core/include/mp-units/ext/prime.h @@ -28,6 +28,9 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -35,6 +38,7 @@ #include #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/ext/type_name.h b/src/core/include/mp-units/ext/type_name.h index e768755e..03d7e6ec 100644 --- a/src/core/include/mp-units/ext/type_name.h +++ b/src/core/include/mp-units/ext/type_name.h @@ -6,8 +6,12 @@ #pragma once #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/ext/type_traits.h b/src/core/include/mp-units/ext/type_traits.h index 25b47e95..62e39f09 100644 --- a/src/core/include/mp-units/ext/type_traits.h +++ b/src/core/include/mp-units/ext/type_traits.h @@ -26,9 +26,13 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/format.h b/src/core/include/mp-units/format.h index c9684018..8cc5f25e 100644 --- a/src/core/include/mp-units/format.h +++ b/src/core/include/mp-units/format.h @@ -35,8 +35,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units::detail { diff --git a/src/core/include/mp-units/framework/compare.h b/src/core/include/mp-units/framework/compare.h index 718e9c55..aef69ae8 100644 --- a/src/core/include/mp-units/framework/compare.h +++ b/src/core/include/mp-units/framework/compare.h @@ -26,8 +26,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif MP_UNITS_EXPORT namespace mp_units { diff --git a/src/core/include/mp-units/framework/construction_helpers.h b/src/core/include/mp-units/framework/construction_helpers.h index 48d1be05..6e20ebcc 100644 --- a/src/core/include/mp-units/framework/construction_helpers.h +++ b/src/core/include/mp-units/framework/construction_helpers.h @@ -28,8 +28,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/customization_points.h b/src/core/include/mp-units/framework/customization_points.h index 1396d229..15fbf807 100644 --- a/src/core/include/mp-units/framework/customization_points.h +++ b/src/core/include/mp-units/framework/customization_points.h @@ -27,10 +27,14 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/dimension.h b/src/core/include/mp-units/framework/dimension.h index 579f68a6..6b2cb360 100644 --- a/src/core/include/mp-units/framework/dimension.h +++ b/src/core/include/mp-units/framework/dimension.h @@ -37,6 +37,9 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -44,7 +47,8 @@ #if MP_UNITS_HOSTED #include #endif -#endif +#endif // MP_UNITS_IMPORT_STD +#endif // MP_UNITS_IN_MODULE_INTERFACE namespace mp_units { diff --git a/src/core/include/mp-units/framework/expression_template.h b/src/core/include/mp-units/framework/expression_template.h index 0e1c0dc2..c0ec574b 100644 --- a/src/core/include/mp-units/framework/expression_template.h +++ b/src/core/include/mp-units/framework/expression_template.h @@ -28,9 +28,13 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/magnitude.h b/src/core/include/mp-units/framework/magnitude.h index dd083de8..8fb22eb8 100644 --- a/src/core/include/mp-units/framework/magnitude.h +++ b/src/core/include/mp-units/framework/magnitude.h @@ -36,12 +36,16 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/quantity.h b/src/core/include/mp-units/framework/quantity.h index b601c307..9933a760 100644 --- a/src/core/include/mp-units/framework/quantity.h +++ b/src/core/include/mp-units/framework/quantity.h @@ -39,9 +39,13 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/quantity_cast.h b/src/core/include/mp-units/framework/quantity_cast.h index fca664b7..dc487c32 100644 --- a/src/core/include/mp-units/framework/quantity_cast.h +++ b/src/core/include/mp-units/framework/quantity_cast.h @@ -29,8 +29,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif MP_UNITS_EXPORT namespace mp_units { diff --git a/src/core/include/mp-units/framework/quantity_point.h b/src/core/include/mp-units/framework/quantity_point.h index 5380366b..aa4763d6 100644 --- a/src/core/include/mp-units/framework/quantity_point.h +++ b/src/core/include/mp-units/framework/quantity_point.h @@ -31,8 +31,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 5ba3b2cb..88eec204 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -38,11 +38,15 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/reference.h b/src/core/include/mp-units/framework/reference.h index 9fe0599e..c6424e1f 100644 --- a/src/core/include/mp-units/framework/reference.h +++ b/src/core/include/mp-units/framework/reference.h @@ -31,8 +31,12 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/representation_concepts.h b/src/core/include/mp-units/framework/representation_concepts.h index 74014074..6019d215 100644 --- a/src/core/include/mp-units/framework/representation_concepts.h +++ b/src/core/include/mp-units/framework/representation_concepts.h @@ -27,11 +27,15 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/framework/symbol_text.h b/src/core/include/mp-units/framework/symbol_text.h index a266cb24..f0a75313 100644 --- a/src/core/include/mp-units/framework/symbol_text.h +++ b/src/core/include/mp-units/framework/symbol_text.h @@ -32,15 +32,23 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include // IWYU pragma: export #include #include #endif +#endif #if __cpp_lib_text_encoding #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif static_assert(std::text_encoding::literal().mib() == std::text_encoding::id::UTF8); #endif diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index 62fb43a7..411f3256 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -43,6 +43,9 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -50,7 +53,8 @@ #if MP_UNITS_HOSTED #include #endif -#endif +#endif // MP_UNITS_IMPORT_STD +#endif // MP_UNITS_IN_MODULE_INTERFACE namespace mp_units { diff --git a/src/core/include/mp-units/math.h b/src/core/include/mp-units/math.h index 50dd222a..830d8d0a 100644 --- a/src/core/include/mp-units/math.h +++ b/src/core/include/mp-units/math.h @@ -32,10 +32,14 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #endif +#endif MP_UNITS_EXPORT namespace mp_units { diff --git a/src/core/include/mp-units/ostream.h b/src/core/include/mp-units/ostream.h index fbf7d575..e2464bd7 100644 --- a/src/core/include/mp-units/ostream.h +++ b/src/core/include/mp-units/ostream.h @@ -30,9 +30,13 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #endif +#endif namespace mp_units { diff --git a/src/core/include/mp-units/random.h b/src/core/include/mp-units/random.h index 145f7161..a470c3b0 100644 --- a/src/core/include/mp-units/random.h +++ b/src/core/include/mp-units/random.h @@ -26,9 +26,11 @@ #include #ifndef MP_UNITS_IN_MODULE_INTERFACE +#ifndef MP_UNITS_IMPORT_STD #include #include #endif +#endif namespace mp_units { diff --git a/src/core/mp-units-core.cpp b/src/core/mp-units-core.cpp index 16a75677..eb0a3c20 100644 --- a/src/core/mp-units-core.cpp +++ b/src/core/mp-units-core.cpp @@ -22,10 +22,16 @@ module; +#ifndef MP_UNITS_IMPORT_STD #include +#endif export module mp_units.core; +#ifdef MP_UNITS_IMPORT_STD +import std; +#endif + #define MP_UNITS_IN_MODULE_INTERFACE #include diff --git a/src/systems/include/mp-units/systems/angular/math.h b/src/systems/include/mp-units/systems/angular/math.h index 6dc96e86..f6a7a0fa 100644 --- a/src/systems/include/mp-units/systems/angular/math.h +++ b/src/systems/include/mp-units/systems/angular/math.h @@ -32,8 +32,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif MP_UNITS_EXPORT diff --git a/src/systems/include/mp-units/systems/si/chrono.h b/src/systems/include/mp-units/systems/si/chrono.h index d5b6c55d..fa878269 100644 --- a/src/systems/include/mp-units/systems/si/chrono.h +++ b/src/systems/include/mp-units/systems/si/chrono.h @@ -32,8 +32,12 @@ #ifndef MP_UNITS_IN_MODULE_INTERFACE #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif namespace mp_units { diff --git a/src/systems/include/mp-units/systems/si/math.h b/src/systems/include/mp-units/systems/si/math.h index 590a14ea..b3d9b483 100644 --- a/src/systems/include/mp-units/systems/si/math.h +++ b/src/systems/include/mp-units/systems/si/math.h @@ -33,8 +33,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #endif +#endif MP_UNITS_EXPORT diff --git a/src/systems/mp-units-systems.cpp b/src/systems/mp-units-systems.cpp index f0dfd453..71ce35c7 100644 --- a/src/systems/mp-units-systems.cpp +++ b/src/systems/mp-units-systems.cpp @@ -22,12 +22,17 @@ module; +#ifndef MP_UNITS_IMPORT_STD #include #include +#endif export module mp_units.systems; export import mp_units.core; +#ifdef MP_UNITS_IMPORT_STD +import std; +#endif #define MP_UNITS_IN_MODULE_INTERFACE diff --git a/test/runtime/atomic_test.cpp b/test/runtime/atomic_test.cpp index 64e00915..5bca3157 100644 --- a/test/runtime/atomic_test.cpp +++ b/test/runtime/atomic_test.cpp @@ -21,7 +21,11 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/distribution_test.cpp b/test/runtime/distribution_test.cpp index 8a26fb8c..9df1eb3b 100644 --- a/test/runtime/distribution_test.cpp +++ b/test/runtime/distribution_test.cpp @@ -21,12 +21,16 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/fixed_string_test.cpp b/test/runtime/fixed_string_test.cpp index eaeebb66..b1b01f21 100644 --- a/test/runtime/fixed_string_test.cpp +++ b/test/runtime/fixed_string_test.cpp @@ -24,8 +24,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/fmt_test.cpp b/test/runtime/fmt_test.cpp index f3b98aa7..7df94d90 100644 --- a/test/runtime/fmt_test.cpp +++ b/test/runtime/fmt_test.cpp @@ -25,6 +25,9 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -32,6 +35,7 @@ #include #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/linear_algebra_test.cpp b/test/runtime/linear_algebra_test.cpp index a63c53ac..0a8e8ef7 100644 --- a/test/runtime/linear_algebra_test.cpp +++ b/test/runtime/linear_algebra_test.cpp @@ -23,8 +23,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/math_test.cpp b/test/runtime/math_test.cpp index 9533ee84..2a59135b 100644 --- a/test/runtime/math_test.cpp +++ b/test/runtime/math_test.cpp @@ -23,7 +23,11 @@ #include "almost_equals.h" #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/runtime/truncation_test.cpp b/test/runtime/truncation_test.cpp index af780d80..3ff10046 100644 --- a/test/runtime/truncation_test.cpp +++ b/test/runtime/truncation_test.cpp @@ -25,8 +25,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/static/angular_test.cpp b/test/static/angular_test.cpp index 9011f231..98e11b4a 100644 --- a/test/static/angular_test.cpp +++ b/test/static/angular_test.cpp @@ -21,7 +21,11 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/chrono_test.cpp b/test/static/chrono_test.cpp index 92633d92..9f3b1901 100644 --- a/test/static/chrono_test.cpp +++ b/test/static/chrono_test.cpp @@ -25,9 +25,13 @@ #include // IWYU pragma: keep #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif namespace { diff --git a/test/static/concepts_test.cpp b/test/static/concepts_test.cpp index 769d92ae..17cf6d81 100644 --- a/test/static/concepts_test.cpp +++ b/test/static/concepts_test.cpp @@ -23,6 +23,9 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #if MP_UNITS_HOSTED @@ -30,6 +33,7 @@ #include #include #endif +#endif #if MP_UNITS_HOSTED template diff --git a/test/static/custom_rep_test_min_expl.cpp b/test/static/custom_rep_test_min_expl.cpp index 9288679d..e16ab60b 100644 --- a/test/static/custom_rep_test_min_expl.cpp +++ b/test/static/custom_rep_test_min_expl.cpp @@ -20,8 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/static/custom_rep_test_min_impl.cpp b/test/static/custom_rep_test_min_impl.cpp index 96be3598..8e8c3b7c 100644 --- a/test/static/custom_rep_test_min_impl.cpp +++ b/test/static/custom_rep_test_min_impl.cpp @@ -24,8 +24,12 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif namespace { diff --git a/test/static/dimension_symbol_test.cpp b/test/static/dimension_symbol_test.cpp index 71b971a2..9f0dbf1d 100644 --- a/test/static/dimension_symbol_test.cpp +++ b/test/static/dimension_symbol_test.cpp @@ -22,7 +22,11 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/dimension_test.cpp b/test/static/dimension_test.cpp index 5564a5f1..8064831e 100644 --- a/test/static/dimension_test.cpp +++ b/test/static/dimension_test.cpp @@ -23,7 +23,11 @@ #include "test_tools.h" #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/fixed_string_test.cpp b/test/static/fixed_string_test.cpp index f0001c79..e59d3fc4 100644 --- a/test/static/fixed_string_test.cpp +++ b/test/static/fixed_string_test.cpp @@ -21,8 +21,12 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif using namespace mp_units; diff --git a/test/static/prime_test.cpp b/test/static/prime_test.cpp index 21a7b571..d3c50f09 100644 --- a/test/static/prime_test.cpp +++ b/test/static/prime_test.cpp @@ -21,9 +21,13 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include +#endif using namespace mp_units::detail; diff --git a/test/static/quantity_point_test.cpp b/test/static/quantity_point_test.cpp index 39ea755f..06ad1f16 100644 --- a/test/static/quantity_point_test.cpp +++ b/test/static/quantity_point_test.cpp @@ -26,6 +26,9 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -34,6 +37,7 @@ #if MP_UNITS_HOSTED #include #endif +#endif namespace { diff --git a/test/static/quantity_spec_test.cpp b/test/static/quantity_spec_test.cpp index fcd10fc5..ee4e86a8 100644 --- a/test/static/quantity_spec_test.cpp +++ b/test/static/quantity_spec_test.cpp @@ -23,7 +23,11 @@ #include "test_tools.h" #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/quantity_test.cpp b/test/static/quantity_test.cpp index 56fd4261..9b3abbb0 100644 --- a/test/static/quantity_test.cpp +++ b/test/static/quantity_test.cpp @@ -27,6 +27,9 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include #include @@ -35,6 +38,7 @@ #if MP_UNITS_HOSTED #include #endif +#endif template<> inline constexpr bool mp_units::is_vector = true; diff --git a/test/static/reference_test.cpp b/test/static/reference_test.cpp index e5f6e3be..65abe0bb 100644 --- a/test/static/reference_test.cpp +++ b/test/static/reference_test.cpp @@ -23,8 +23,12 @@ #include "test_tools.h" #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include #include +#endif namespace { diff --git a/test/static/si_test.cpp b/test/static/si_test.cpp index 8a95c9a0..0b06630a 100644 --- a/test/static/si_test.cpp +++ b/test/static/si_test.cpp @@ -21,7 +21,11 @@ // SOFTWARE. #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/test_tools.h b/test/static/test_tools.h index 2a1e29b8..88dfc6cb 100644 --- a/test/static/test_tools.h +++ b/test/static/test_tools.h @@ -24,7 +24,11 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif template inline constexpr bool is_of_type = std::is_same_v; diff --git a/test/static/type_list_test.cpp b/test/static/type_list_test.cpp index 50e83507..35af8b60 100644 --- a/test/static/type_list_test.cpp +++ b/test/static/type_list_test.cpp @@ -22,7 +22,11 @@ #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/unit_symbol_test.cpp b/test/static/unit_symbol_test.cpp index 1a7ea663..41af02f2 100644 --- a/test/static/unit_symbol_test.cpp +++ b/test/static/unit_symbol_test.cpp @@ -23,7 +23,11 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace { diff --git a/test/static/unit_test.cpp b/test/static/unit_test.cpp index 11b34865..8250962f 100644 --- a/test/static/unit_test.cpp +++ b/test/static/unit_test.cpp @@ -24,7 +24,11 @@ #include #include #include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else #include +#endif namespace {