refactor: got rid of gcc-9 backlog

BREAKING CHANGE: gcc-9.3 no longer supported
This commit is contained in:
Mateusz Pusz committed 2020-09-08 13:09:34 +02:00
1 parent 7ed4f19ef3
commit 4bb51586dc
27 files changed
+131 -760

No files matched your search

-8
View File
@@ -76,16 +76,8 @@ using common_quantity_point = decltype(
} // namespace units
#if COMP_MSVC || COMP_GCC >= 10
namespace std {
#else
namespace concepts {
#endif
template<units::Quantity Q1, units::Quantity Q2>
requires units::equivalent_dim<typename Q1::dimension, typename Q2::dimension>
struct common_type<Q1, Q2> {
-73
View File
@@ -26,10 +26,7 @@
#include <algorithm>
#include <cstdlib>
#include <ostream>
#if COMP_MSVC || COMP_GCC >= 10
#include <compare>
#endif
namespace units {
@@ -76,8 +73,6 @@ struct basic_fixed_string {
return basic_fixed_string<CharT, N + N2>(txt);
}
#if COMP_MSVC || COMP_GCC >= 10
[[nodiscard]] constexpr bool operator==(const basic_fixed_string& other) const
{
return std::ranges::equal(*this, other);
@@ -92,74 +87,6 @@ struct basic_fixed_string {
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
#else
[[nodiscard]] constexpr friend bool operator==(const basic_fixed_string& lhs, const basic_fixed_string& rhs) noexcept
{
for (size_t i = 0; i != lhs.size(); ++i)
if (lhs.data_[i] != rhs.data_[i]) return false;
return true;
}
[[nodiscard]] constexpr friend bool operator!=(const basic_fixed_string& lhs, const basic_fixed_string& rhs) noexcept
{
return !(lhs == rhs);
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator==(const basic_fixed_string&,
const basic_fixed_string<CharT2, N2>&) noexcept
{
return false;
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator!=(const basic_fixed_string&,
const basic_fixed_string<CharT2, N2>&) noexcept
{
return true;
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator<(const basic_fixed_string& lhs,
const basic_fixed_string<CharT2, N2>& rhs) noexcept
{
using std::begin, std::end;
auto first1 = begin(lhs.data_);
auto first2 = begin(rhs.data_);
const auto last1 = std::prev(end(lhs.data_)); // do not waste time for '\0'
const auto last2 = std::prev(end(rhs.data_));
for (; (first1 != last1) && (first2 != last2); ++first1, (void)++first2) {
if (*first1 < *first2) return true;
if (*first2 < *first1) return false;
}
return first1 == last1 && first2 != last2;
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator>(const basic_fixed_string& lhs,
const basic_fixed_string<CharT2, N2>& rhs) noexcept
{
return rhs < lhs;
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator<=(const basic_fixed_string& lhs,
const basic_fixed_string<CharT2, N2>& rhs) noexcept
{
return !(rhs < lhs);
}
template<typename CharT2, std::size_t N2>
[[nodiscard]] constexpr friend bool operator>=(const basic_fixed_string& lhs,
const basic_fixed_string<CharT2, N2>& rhs) noexcept
{
return !(lhs < rhs);
}
#endif
template<class Traits>
friend std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
const basic_fixed_string& txt)
+7 -70
View File
@@ -22,7 +22,7 @@
#pragma once
#include <functional>
#include <concepts>
#if __clang__
#define COMP_CLANG __clang_major__
@@ -33,29 +33,6 @@
#define COMP_MSVC _MSC_VER
#endif
#if COMP_MSVC || COMP_GCC >= 10
#include <concepts>
#else
#include <concepts/concepts.hpp>
#include <range/v3/range.hpp>
#endif
#if COMP_MSVC || COMP_GCC >= 10 || COMP_CLANG >= 11
#define AUTO auto
#define SAME_AS(T) std::same_as<T>
#else
#define AUTO
#define SAME_AS(T) T
#endif
#if COMP_MSVC
#define TYPENAME typename
@@ -66,53 +43,13 @@
#endif
#if COMP_GCC
namespace std {
#if COMP_GCC
#if COMP_GCC >= 10
template<class T>
concept default_constructible = constructible_from<T>;
#else
// concepts
using concepts::common_reference_with;
using concepts::common_with;
using concepts::constructible_from;
using concepts::convertible_to;
using concepts::default_constructible;
using concepts::derived_from;
using concepts::equality_comparable;
using concepts::equality_comparable_with;
// using concepts::floating_point;
using concepts::integral;
using concepts::regular;
using concepts::same_as;
using concepts::totally_ordered;
using concepts::totally_ordered_with;
namespace ranges {
using ::ranges::forward_range;
using ::ranges::range_value_t;
}
// missing in Range-v3
template<class T>
concept floating_point = std::is_floating_point_v<T>;
template<class F, class... Args>
concept invocable =
requires(F&& f, Args&&... args) {
std::invoke(std::forward<F>(f), std::forward<Args>(args)...);
};
template<class F, class... Args>
concept regular_invocable = invocable<F, Args...>;
#endif
#endif
template<class T>
concept default_constructible = constructible_from<T>;
} // namespace std
#endif