mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 03:14:29 +02:00
feat: complex.h
added
This commit is contained in:
@@ -91,9 +91,10 @@ if(NOT ${projectPrefix}API_FREESTANDING)
|
|||||||
include/mp-units/bits/fmt.h
|
include/mp-units/bits/fmt.h
|
||||||
include/mp-units/bits/requires_hosted.h
|
include/mp-units/bits/requires_hosted.h
|
||||||
include/mp-units/ext/format.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/math.h
|
||||||
include/mp-units/ostream.h
|
include/mp-units/ostream.h
|
||||||
include/mp-units/format.h
|
|
||||||
include/mp-units/random.h
|
include/mp-units/random.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -57,6 +57,7 @@
|
|||||||
#ifndef MP_UNITS_IMPORT_STD
|
#ifndef MP_UNITS_IMPORT_STD
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <complex>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
43
src/core/include/mp-units/complex.h
Normal file
43
src/core/include/mp-units/complex.h
Normal 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;
|
||||||
|
|
||||||
|
}
|
@@ -28,6 +28,7 @@
|
|||||||
#include <mp-units/framework.h>
|
#include <mp-units/framework.h>
|
||||||
|
|
||||||
#if MP_UNITS_HOSTED
|
#if MP_UNITS_HOSTED
|
||||||
|
#include <mp-units/complex.h>
|
||||||
#include <mp-units/format.h>
|
#include <mp-units/format.h>
|
||||||
#include <mp-units/math.h>
|
#include <mp-units/math.h>
|
||||||
#include <mp-units/ostream.h>
|
#include <mp-units/ostream.h>
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
#include <mp-units/systems/isq/space_and_time.h>
|
#include <mp-units/systems/isq/space_and_time.h>
|
||||||
#include <mp-units/systems/natural.h>
|
#include <mp-units/systems/natural.h>
|
||||||
#include <mp-units/systems/si.h>
|
#include <mp-units/systems/si.h>
|
||||||
|
#if MP_UNITS_HOSTED
|
||||||
|
#include <mp-units/complex.h>
|
||||||
|
#endif
|
||||||
#ifdef MP_UNITS_IMPORT_STD
|
#ifdef MP_UNITS_IMPORT_STD
|
||||||
import std;
|
import std;
|
||||||
#else
|
#else
|
||||||
@@ -35,12 +38,6 @@ import std;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MP_UNITS_HOSTED
|
|
||||||
template<typename T>
|
|
||||||
constexpr bool mp_units::is_complex<std::complex<T>> = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <mp-units/systems/isq/space_and_time.h>
|
#include <mp-units/systems/isq/space_and_time.h>
|
||||||
#include <mp-units/systems/si.h>
|
#include <mp-units/systems/si.h>
|
||||||
#if MP_UNITS_HOSTED
|
#if MP_UNITS_HOSTED
|
||||||
|
#include <mp-units/complex.h>
|
||||||
#include <mp-units/math.h>
|
#include <mp-units/math.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef MP_UNITS_IMPORT_STD
|
#ifdef MP_UNITS_IMPORT_STD
|
||||||
@@ -45,11 +46,6 @@ import std;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MP_UNITS_HOSTED
|
|
||||||
template<typename T>
|
|
||||||
constexpr bool mp_units::is_complex<std::complex<T>> = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
constexpr bool mp_units::is_vector<int> = true;
|
constexpr bool mp_units::is_vector<int> = true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user