feat: complex.h added

This commit is contained in:
Mateusz Pusz
2024-11-07 10:58:51 +01:00
parent 8f062bfa87
commit 75b50b8d2c
6 changed files with 51 additions and 12 deletions

View File

@@ -91,9 +91,10 @@ if(NOT ${projectPrefix}API_FREESTANDING)
include/mp-units/bits/fmt.h
include/mp-units/bits/requires_hosted.h
include/mp-units/ext/format.h
include/mp-units/complex.h
include/mp-units/format.h
include/mp-units/math.h
include/mp-units/ostream.h
include/mp-units/format.h
include/mp-units/random.h
)
endif()

View File

@@ -57,6 +57,7 @@
#ifndef MP_UNITS_IMPORT_STD
#include <chrono>
#include <cmath>
#include <complex>
#include <locale>
#include <ostream>
#include <random>

View File

@@ -0,0 +1,43 @@
// The MIT License (MIT)
//
// Copyright (c) 2018 Mateusz Pusz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <mp-units/bits/requires_hosted.h>
//
#include <mp-units/bits/module_macros.h>
#include <mp-units/framework/customization_points.h>
#ifndef MP_UNITS_IN_MODULE_INTERFACE
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
#include <complex>
#endif
#endif
namespace mp_units {
template<typename T>
constexpr bool is_complex<std::complex<T>> = true;
}

View File

@@ -28,6 +28,7 @@
#include <mp-units/framework.h>
#if MP_UNITS_HOSTED
#include <mp-units/complex.h>
#include <mp-units/format.h>
#include <mp-units/math.h>
#include <mp-units/ostream.h>

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>
#if MP_UNITS_HOSTED
#include <mp-units/complex.h>
#endif
#ifdef MP_UNITS_IMPORT_STD
import std;
#else
@@ -35,12 +38,6 @@ import std;
#endif
#endif
#if MP_UNITS_HOSTED
template<typename T>
constexpr bool mp_units::is_complex<std::complex<T>> = true;
#endif
namespace {
using namespace mp_units;

View File

@@ -29,6 +29,7 @@
#include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si.h>
#if MP_UNITS_HOSTED
#include <mp-units/complex.h>
#include <mp-units/math.h>
#endif
#ifdef MP_UNITS_IMPORT_STD
@@ -45,11 +46,6 @@ import std;
#endif
#endif
#if MP_UNITS_HOSTED
template<typename T>
constexpr bool mp_units::is_complex<std::complex<T>> = true;
#endif
template<>
constexpr bool mp_units::is_vector<int> = true;