aboutsummaryrefslogtreecommitdiffstats
path: root/find.hpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2024-08-10 10:50:47 -0400
committerClyne Sullivan <clyne@bitgloo.com>2024-08-10 10:50:47 -0400
commitcd96a31b3ea11edf26512c33ca599258601c31a0 (patch)
treed5cfbb9b3c936f36a4d30f9b8024e3ef7e27bcd7 /find.hpp
parent00f84e3b984904e36cbee502a470003ecd7d09cf (diff)
move library to a folder
Diffstat (limited to 'find.hpp')
-rw-r--r--find.hpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/find.hpp b/find.hpp
deleted file mode 100644
index edba06d..0000000
--- a/find.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef MBUOY_FIND_HPP
-#define MBUOY_FIND_HPP
-
-#include <optional>
-#include <type_traits>
-
-namespace mbuoy {
-
-template<typename T, typename U>
-concept can_static_cast = requires(U u) {
- static_cast<T>(u);
-};
-
-template<typename T>
-consteval std::optional<T> find(T val)
-{
- return val;
-}
-
-template<typename T, typename U>
- requires (!std::is_same_v<T, U> && can_static_cast<T, U>)
-consteval std::optional<U> find(U val)
-{
- return val;
-}
-
-template<typename T, typename U>
- requires (!std::is_same_v<T, U> && !can_static_cast<T, U>)
-consteval std::optional<T> find(U val)
-{
- return {};
-}
-
-template<typename T>
-consteval std::optional<T> find(T val, auto... vals)
-{
- return val;
-}
-
-template<typename T, typename U>
- requires (!std::is_same_v<T, U> && can_static_cast<T, U>)
-consteval std::optional<U> find(U val, auto... vals)
-{
- return val;
-}
-
-template<typename T, typename U>
- requires (!std::is_same_v<T, U> && !can_static_cast<T, U>)
-consteval auto find(U val, auto... vals)
-{
- return find<T>(vals...);
-}
-
-} // namespace mbuoy
-
-#endif // MBUOY_FIND_HPP
-