Hand written concepts replaced with Casey Carter's repository

This commit is contained in:
Mateusz Pusz
2019-04-05 17:43:42 +02:00
parent 5b135b1251
commit 6646051e65
13 changed files with 24 additions and 67 deletions
-48
View File
@@ -1,48 +0,0 @@
// 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 <ratio>
#include <type_traits>
namespace mp {
namespace std_concepts {
template<typename T, typename U>
concept bool Same = std::is_same_v<T, U>;
template<typename From, typename To>
concept bool ConvertibleTo =
std::is_convertible_v<From, To> &&
requires(From (&f)()) {
static_cast<To>(f());
};
template<class Derived, class Base>
concept bool DerivedFrom =
std::is_base_of_v<Base, Derived> &&
std::is_convertible_v<const volatile Derived*, const volatile Base*>;
} // namespace std_concepts
} // namespace mp
+1 -3
View File
@@ -22,7 +22,7 @@
#pragma once
#include "stdconcepts.h"
#include <experimental/ranges/concepts>
#include <ratio>
#include <type_traits>
@@ -38,8 +38,6 @@ namespace std {
namespace units {
using namespace mp::std_concepts; // todo Remove when std::concepts will arrive
template<typename T>
concept bool Number = requires(T a, T b) {
{ a + b } -> T;