diff --git a/conanfile.py b/conanfile.py index 59b731c28..339ef9126 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 @@ def _feature_compatibility(self): "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 @@ def _option_feature_map(self): 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 @@ def requirements(self): 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 @@ def validate(self): 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 @@ def generate(self): 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 eb283fdc5..e93d33049 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 70907a8a5..dc2d24d22 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 30ccdd42d..4cf363fe1 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 a1f252ad5..42ed6d0b0 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 cc5ff291e..af80465bd 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 b34fdc401..6f280659b 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 2bb1e7d06..6d93b34ec 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 e263d1495..133a7713a 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 6342a9052..fcefe0813 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 8f26bb4c0..5e2ac4dbf 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 f11f8a3a5..e635bc25f 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 accda5509..ba26b3f1a 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 350a3b04f..67557624f 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 f4df44b23..efc1d9464 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 501dd2cc9..6e6294779 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 da718a982..b6cd0e128 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 a291813fe..daec350c5 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 a69c39e6c..2e51cba15 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 b04ae9712..f4df77a55 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 d12a22fe5..b6071b27d 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 a5c29d8e6..93a4d0f9f 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 23ad51d40..d4acad8b5 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 adfc56e27..c3b37fd79 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 d8bd2297c..5e1e54194 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 56b016a8f..022003f95 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 e8fa0cfb3..3fce6a8b7 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 7e004cf07..ad9f75805 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 58ee1e2e6..6487860df 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 63f26f44e..bcd149d6f 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 cfb810928..3e26ac08c 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 675918acc..c3fffafc3 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 ce9b96fd5..611bfcc74 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 c920c6ae4..3f2953439 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 eee5622a6..c4572a9c7 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 85e49afce..329f51068 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 c79ff946f..a01eb4a78 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 a15a673c1..203326c6b 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 6c50dedca..564000ac7 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 2bcc45e0d..0fde61ed8 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 72aca3a9e..382d02a56 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 02682bcdb..1e93caf4d 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 31d4f2ccb..5b372fe95 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 e768755e0..03d7e6ec0 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 25b47e954..62e39f09c 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 c96840188..8cc5f25e3 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 718e9c550..aef69ae8f 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 48d1be053..6e20ebccb 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 1396d2292..15fbf8078 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 579f68a66..6b2cb3603 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 0e1c0dc2d..c0ec574b1 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 dd083de89..8fb22eb81 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 b601c307e..9933a7609 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 fca664b7d..dc487c325 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 5380366be..aa4763d63 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 5ba3b2cb3..88eec2048 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 9fe0599ef..c6424e1f5 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 74014074a..6019d215b 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 a266cb244..f0a753138 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 62fb43a79..411f3256f 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 50dd222ab..830d8d0aa 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 fbf7d575a..e2464bd70 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 145f71618..a470c3b01 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 16a75677f..eb0a3c206 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 6dc96e860..f6a7a0fae 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 d5b6c55d9..fa878269f 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 590a14eaf..b3d9b4836 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 f0dfd4534..71ce35c7c 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 64e009155..5bca3157e 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 8a26fb8c3..9df1eb3bf 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 eaeebb661..b1b01f214 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 f3b98aa7c..7df94d90d 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 a63c53acf..0a8e8ef79 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 9533ee845..2a59135b8 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 af780d805..3ff100467 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 9011f2318..98e11b4aa 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 92633d924..9f3b19016 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 769d92ae6..17cf6d814 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 9288679d3..e16ab60b0 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 96be35981..8e8c3b7c1 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 71b971a2a..9f0dbf1d6 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 5564a5f1d..8064831eb 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 f0001c796..e59d3fc4e 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 21a7b5710..d3c50f09e 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 39ea755f1..06ad1f16a 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 fcd10fc56..ee4e86a8c 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 56fd42613..9b3abbb0a 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 e5f6e3bee..65abe0bbf 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 8a95c9a09..0b06630aa 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 2a1e29b83..88dfc6cbb 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 50e835076..35af8b605 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 1a7ea6631..41af02f2f 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 11b348651..8250962f7 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 {