-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More core cleanup & update to new callable style
- Loading branch information
Showing
186 changed files
with
3,416 additions
and
3,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/module/core/constant/eps.hpp> | ||
#include <eve/module/core/decorator/core.hpp> | ||
#include <eve/module/core/regular/convert.hpp> | ||
|
||
namespace eve | ||
{ | ||
// =============================================================================================== | ||
//almost | ||
|
||
template<typename Value> | ||
struct almost_t | ||
{ | ||
constexpr almost_t() {} | ||
constexpr explicit almost_t(Value v) : value_(v) {} | ||
constexpr almost_t(almost_t const& v) : value_(v.value_) {} | ||
|
||
/// ID type associated to the keyword | ||
using id_type = almost_mode; | ||
|
||
template<typename T> static constexpr bool accept() { return true; } | ||
|
||
std::ostream& show(std::ostream& os, auto const& v) const | ||
{ | ||
return os << "almost by " << v.value_; | ||
} | ||
|
||
using tag_type = almost_t<default_tolerance>; | ||
using keyword_type = almost_t<default_tolerance>; | ||
using stored_value_type = almost_t<Value>; | ||
|
||
template<eve::scalar_value Type> | ||
constexpr auto operator=(Type v) const noexcept { return almost_t<Type>{v}; } | ||
|
||
template<typename T> | ||
constexpr auto operator=(almost_t<T> const& v) const noexcept | ||
{ | ||
return v; | ||
} | ||
|
||
constexpr auto operator()(keyword_type const&) const noexcept { return *this; } | ||
|
||
template<typename T> constexpr auto value(T const&) const | ||
{ | ||
using type = element_type_t<T>; | ||
if constexpr(std::same_as<Value,default_tolerance>) return 3 * eps(as<type>{}); | ||
else if constexpr(integral_value<Value>) return value_; | ||
else return type{value_}; | ||
} | ||
|
||
Value value_; | ||
}; | ||
|
||
inline constexpr almost_t<default_tolerance> almost2 = {}; | ||
|
||
inline constexpr auto as_option(almost_type const&) { return almost2; } | ||
|
||
// ============================================================================================ | ||
// definitely | ||
|
||
template<typename Value> | ||
struct definitely_t | ||
{ | ||
constexpr definitely_t() {} | ||
constexpr explicit definitely_t(Value v) : value_(v) {} | ||
constexpr definitely_t(definitely_t const& v) : value_(v.value_) {} | ||
|
||
/// ID type associated to the keyword | ||
using id_type = definitely_mode; | ||
|
||
template<typename T> static constexpr bool accept() { return true; } | ||
|
||
std::ostream& show(std::ostream& os, auto const& v) const | ||
{ | ||
return os << "definitely by " << v.value_; | ||
} | ||
|
||
using tag_type = definitely_t<default_tolerance>; | ||
using keyword_type = definitely_t<default_tolerance>; | ||
using stored_value_type = definitely_t<Value>; | ||
|
||
template<eve::scalar_value Type> | ||
constexpr auto operator=(Type v) const noexcept { return definitely_t<Type>{v}; } | ||
|
||
template<typename T> | ||
constexpr auto operator=(definitely_t<T> const& v) const noexcept | ||
{ | ||
return v; | ||
} | ||
|
||
constexpr auto operator()(keyword_type const&) const noexcept { return *this; } | ||
|
||
template<typename T> constexpr auto value(T const&) const | ||
{ | ||
using type = element_type_t<T>; | ||
if constexpr(std::same_as<Value,default_tolerance>) return 3 * eps(as<type>{}); | ||
else if constexpr(integral_value<Value>) return value_; | ||
else return type{value_}; | ||
} | ||
|
||
Value value_; | ||
}; | ||
|
||
inline constexpr definitely_t<default_tolerance> definitely2 = {}; | ||
|
||
inline constexpr auto as_option(definitely_type const&) { return definitely2; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.