range-v3 dependency removed for gcc-10

This commit is contained in:
Mateusz Pusz
2019-12-08 16:09:00 +01:00
parent 2c29af9670
commit d465d47803
5 changed files with 35 additions and 12 deletions

View File

@@ -47,10 +47,11 @@ class UnitsConan(ConanFile):
exports_sources = ["src/*", "test/*", "cmake/*", "example/*","CMakeLists.txt"]
settings = "os", "compiler", "build_type", "arch"
requires = (
"range-v3/0.9.1@ericniebler/stable",
"Catch2/2.10.0@catchorg/stable",
"fmt/6.0.0"
)
build_requires = (
"Catch2/2.10.0@catchorg/stable"
)
generators = "cmake"
@property
@@ -73,6 +74,10 @@ class UnitsConan(ConanFile):
cmake.configure(source_folder="src", build_folder="src")
return cmake
def requirements(self):
if Version(self.settings.compiler.version) < "10":
self.requires("range-v3/0.10.0@ericniebler/stable")
def build(self):
cmake = self._configure_cmake()
cmake.build()

View File

@@ -53,7 +53,6 @@ add_library(units INTERFACE)
target_compile_features(units INTERFACE cxx_std_20)
target_link_libraries(units
INTERFACE
CONAN_PKG::range-v3
CONAN_PKG::fmt
)
target_include_directories(units
@@ -71,6 +70,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
-Wno-pedantic
)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
target_link_libraries(units
INTERFACE
CONAN_PKG::range-v3
)
target_compile_options(units
INTERFACE
-fconcepts

View File

@@ -22,7 +22,6 @@
#pragma once
#include <concepts/concepts.hpp>
#include <functional>
#ifdef NDEBUG
@@ -32,16 +31,24 @@
#define Expects(cond) assert(cond);
#endif
#if __GNUC__ > 9
#define AUTO auto
#define SAME_AS(T) std::same_as<T>
#else
#if __GNUC__ < 10
#include <concepts/concepts.hpp>
#define AUTO
#define SAME_AS(T) T
#else
#include <concepts>
#define AUTO auto
#define SAME_AS(T) std::same_as<T>
#endif
namespace std {
#if __GNUC__ < 10
// concepts
using concepts::common_reference_with;
using concepts::common_with;
@@ -64,4 +71,11 @@ namespace std {
template<class F, class... Args>
concept regular_invocable = invocable<F, Args...>;
}
#else
template<class T>
concept default_constructible = constructible_from<T>;
#endif
} // namespace std

View File

@@ -28,8 +28,8 @@
namespace units {
template<std::size_t N, typename D, typename U, typename Rep>
requires N == 0
inline Rep AUTO pow(const quantity<D, U, Rep>&) noexcept
requires (N == 0)
inline Rep pow(const quantity<D, U, Rep>&) noexcept
{
return 1;
}

View File

@@ -111,7 +111,7 @@ static_assert(std::is_same_v<
unknown_dimension<exp<d0, 1>, exp<d2, 1>>>);
static_assert(std::is_same_v<dimension_multiply<derived_dimension<exp<d0, 1>>, derived_dimension<exp<d0, -1>>>,
unknown_dimension<>>);
static_assert(std::is_same_v<dimension_multiply<derived_dimension<exp<d0, 2>>, unknown_dimension<exp<d0, -1>>>, d0>);
static_assert(std::is_same_v<dimension_multiply<derived_dimension<exp<d0, 2>>, derived_dimension<exp<d0, -1>>>, d0>);
// dimension_divide