feat: import std; support added

Resolves #595
This commit is contained in:
Mateusz Pusz
2024-07-16 17:36:00 +02:00
parent a4691825ee
commit b870b85c25
93 changed files with 425 additions and 9 deletions

View File

@ -21,7 +21,11 @@
// SOFTWARE.
#include <catch2/catch_test_macros.hpp>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <atomic>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -21,12 +21,16 @@
// SOFTWARE.
#include <catch2/catch_test_macros.hpp>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <array>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <random>
#include <vector>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -24,8 +24,12 @@
#include <catch2/matchers/catch_matchers_exception.hpp>
#include <mp-units/compat_macros.h>
#include <mp-units/ext/format.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <sstream>
#include <string_view>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -25,6 +25,9 @@
#include <catch2/matchers/catch_matchers_exception.hpp>
#include <mp-units/compat_macros.h>
#include <mp-units/ext/format.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <cstdint>
#include <iomanip>
#include <limits>
@ -32,6 +35,7 @@
#include <sstream>
#include <string>
#include <string_view>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -23,8 +23,12 @@
#include <catch2/catch_test_macros.hpp>
#include <mp-units/compat_macros.h>
#include <mp-units/ext/format.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <matrix>
#include <ostream>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -23,7 +23,11 @@
#include "almost_equals.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <limits>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -25,8 +25,12 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <mp-units/ext/format.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <limits>
#include <numbers>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -21,7 +21,11 @@
// SOFTWARE.
#include <mp-units/systems/isq_angle.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <numbers>
#endif
namespace {

View File

@ -25,9 +25,13 @@
#include <mp-units/framework/quantity_point.h> // IWYU pragma: keep
#include <mp-units/systems/isq/si_quantities.h>
#include <mp-units/systems/si.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <chrono>
#include <concepts>
#include <ratio>
#endif
namespace {

View File

@ -23,6 +23,9 @@
#include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/natural.h>
#include <mp-units/systems/si.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <optional>
#include <type_traits>
#if MP_UNITS_HOSTED
@ -30,6 +33,7 @@
#include <complex>
#include <string>
#endif
#endif
#if MP_UNITS_HOSTED
template<typename T>

View File

@ -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 <ostream>
#include <type_traits>
#endif
#ifdef MP_UNITS_MODULES
import mp_units;
#else

View File

@ -24,8 +24,12 @@
#include <mp-units/framework.h>
#include <mp-units/systems/si/prefixes.h>
#include <mp-units/systems/si/units.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <concepts>
#include <type_traits>
#endif
namespace {

View File

@ -22,7 +22,11 @@
#include <mp-units/framework.h>
#include <mp-units/systems/isq.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <string_view>
#endif
namespace {

View File

@ -23,7 +23,11 @@
#include "test_tools.h"
#include <mp-units/ext/type_traits.h>
#include <mp-units/framework.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
namespace {

View File

@ -21,8 +21,12 @@
// SOFTWARE.
#include <mp-units/ext/fixed_string.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <array>
#include <string_view>
#endif
using namespace mp_units;

View File

@ -21,9 +21,13 @@
// SOFTWARE.
#include <mp-units/ext/prime.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <array>
#include <cstddef>
#include <utility>
#endif
using namespace mp_units::detail;

View File

@ -26,6 +26,9 @@
#include <mp-units/systems/isq.h>
#include <mp-units/systems/si.h>
#include <mp-units/systems/usc.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <concepts>
#include <cstdint>
#include <limits>
@ -34,6 +37,7 @@
#if MP_UNITS_HOSTED
#include <chrono>
#endif
#endif
namespace {

View File

@ -23,7 +23,11 @@
#include "test_tools.h"
#include <mp-units/ext/type_traits.h>
#include <mp-units/framework.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
namespace {

View File

@ -27,6 +27,9 @@
#include <mp-units/systems/isq/mechanics.h>
#include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <concepts>
#include <cstdint>
#include <limits>
@ -35,6 +38,7 @@
#if MP_UNITS_HOSTED
#include <chrono>
#endif
#endif
template<>
inline constexpr bool mp_units::is_vector<int> = true;

View File

@ -23,8 +23,12 @@
#include "test_tools.h"
#include <mp-units/framework.h>
#include <mp-units/systems/si/prefixes.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <cstdint>
#include <type_traits>
#endif
namespace {

View File

@ -21,7 +21,11 @@
// SOFTWARE.
#include <mp-units/systems/si.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
namespace {

View File

@ -24,7 +24,11 @@
#include <mp-units/bits/hacks.h>
#include <mp-units/framework/quantity_spec.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
template<auto V, typename T>
inline constexpr bool is_of_type = std::is_same_v<MP_UNITS_REMOVE_CONST(decltype(V)), T>;

View File

@ -22,7 +22,11 @@
#include <mp-units/bits/type_list.h>
#include <mp-units/ext/type_traits.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
namespace {

View File

@ -23,7 +23,11 @@
#include <mp-units/systems/iau.h>
#include <mp-units/systems/iec80000.h>
#include <mp-units/systems/si.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <string_view>
#endif
namespace {

View File

@ -24,7 +24,11 @@
#include <mp-units/ext/type_traits.h>
#include <mp-units/framework.h>
#include <mp-units/systems/si/prefixes.h>
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <type_traits>
#endif
namespace {