Skip to content

Commit

Permalink
Removed some problematic concepts that give issues on some compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsylve committed Feb 10, 2022
1 parent 5324070 commit 4d99b04
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 61 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# YATLib [![Build Status](https://travis-ci.com/jtsylve/yatlib.svg?branch=master)](https://travis-ci.com/jtsylve/yatlib)
# YATLib [![Build Status](https://app.travis-ci.com/jtsylve/yatlib.svg?branch=master)](https://app.travis-ci.com/github/jtsylve/yatlib)
Yet Another Template Library for C++

The goals of this project are to provide a centralized library to hold the various general-purpose types that I've used across my projects as well as to provide implementations of library features from C++20 and beyond as well as a select few proposals that have not yet made it into standards.
Expand Down
23 changes: 1 addition & 22 deletions include/yatlib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ concept derived_from;
template <typename From, typename To>
concept convertible_to;

template <typename T, typename U>
concept common_reference_with;

template <typename T>
concept integral;

Expand All @@ -171,12 +168,6 @@ concept unsigned_integral;
template <typename T>
concept floating_point;

template<typename LHS, typename RHS>
concept assignable_from;

template<typename T, typename U>
concept swappable_with;

template <typename T>
concept swappable;

Expand Down Expand Up @@ -225,10 +216,6 @@ concept copy_constructible;

`yat::convertible_to` provides an implementation of [std::convertible_to](https://en.cppreference.com/w/cpp/concepts/convertible_to).

### yat::common_reference_with

`yat::common_reference_with` provides an implementation of [std::common_reference_with](https://en.cppreference.com/w/cpp/concepts/common_reference_with).

### yat::integral

`yat::integral` provides an implementation of [std::integral](https://en.cppreference.com/w/cpp/concepts/integral).
Expand All @@ -245,10 +232,6 @@ concept copy_constructible;

`yat::floating_point` provides an implementation of [std::floating_point](https://en.cppreference.com/w/cpp/concepts/floating_point).

### yat::assignable_from

`yat::assignable_from` provides an implementation of [std::assignable_from](https://en.cppreference.com/w/cpp/concepts/assignable_from).

### yat::swappable

`yat::swappable` provides an implementation of [std::swappable](https://en.cppreference.com/w/cpp/concepts/swappable).
Expand All @@ -259,11 +242,7 @@ concept copy_constructible;

### yat::destructible

`yat::destructible` provides an implementation of [std::destructible](https://en.cppreference.com/w/cpp/concepts/destructible).

### yat::constructible_from

`yat::constructible_from` provides an implementation of [std::constructible_from](https://en.cppreference.com/w/cpp/concepts/contructible_from).
`yat::destructible` provides an implementation of [std::destructible](https://en.cppreference.com/w/cpp/concepts/destructible).q

### yat::default_initializable

Expand Down
38 changes: 0 additions & 38 deletions include/yatlib/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@

namespace yat {

using std::assignable_from;
using std::common_reference_with;
using std::constructible_from;
using std::convertible_to;
using std::copy_constructible;
using std::default_initializable;
Expand Down Expand Up @@ -89,15 +86,6 @@ concept convertible_to = std::is_convertible_v<From, To> &&
static_cast<To>(f());
};

/// The concept common_reference_with<T, U> specifies that two types T and U
/// share a common reference type (as computed by std::common_reference_t) to
/// which both can be converted.
template <typename T, typename U>
concept common_reference_with =
std::same_as<std::common_reference_t<T, U>, std::common_reference_t<U, T> > &&
convertible_to<T, std::common_reference_t<T, U> > &&
convertible_to<U, std::common_reference_t<T, U> >;

/// The concept integral<T> is satisfied if and only if T is an integral type.
template <typename T>
concept integral = std::is_integral_v<T>;
Expand All @@ -119,38 +107,12 @@ concept floating_point = std::is_floating_point_v<T>;

// clang-format off

/// The concept assignable_from<LHS, RHS> specifies that an expression
/// of the type and value category specified by RHS can be assigned to
/// an lvalue expression whose type is specified by LHS.
template <typename LHS, typename RHS>
concept assignable_from =
std::is_lvalue_reference_v<LHS> &&
common_reference_with<const std::remove_reference_t<LHS>&, const std::remove_reference_t<RHS>&> &&
requires(LHS lhs, RHS&& rhs) {
{ lhs = std::forward<RHS>(rhs) } -> std::same_as<LHS>;
};

/// The concept swappable<T> specifies that lvalues of type T are swappable.
template <typename T>
concept swappable = requires(T& a, T& b) {
std::swap(a, b);
};

/// The concept swappable_with<T, U> specifies that expressions of the type
/// and value category encoded by T and U are swappable with each other.
/// swappable_with<T, U> is satisfied only if a call to std::swap(t, u)
/// exchanges the value of t and u, that is, given distinct objects t2 equal
/// to t and u2 equal to u, after evaluating either ranges::swap(t, u) or
/// std::swap(u, t), t2 is equal to u and u2 is equal to t.
template<typename T, typename U>
concept swappable_with = common_reference_with<T, U> &&
requires(T&& t, U&& u) {
std::swap(std::forward<T>(t), std::forward<T>(t));
std::swap(std::forward<U>(u), std::forward<U>(u));
std::swap(std::forward<T>(t), std::forward<U>(u));
std::swap(std::forward<U>(u), std::forward<T>(t));
};

// clang-format on

/// The concept destructible specifies the concept of all types whose instances
Expand Down

0 comments on commit 4d99b04

Please sign in to comment.