From cd96a31b3ea11edf26512c33ca599258601c31a0 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 10 Aug 2024 10:50:47 -0400 Subject: move library to a folder --- find.hpp | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 find.hpp (limited to 'find.hpp') 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 -#include - -namespace mbuoy { - -template -concept can_static_cast = requires(U u) { - static_cast(u); -}; - -template -consteval std::optional find(T val) -{ - return val; -} - -template - requires (!std::is_same_v && can_static_cast) -consteval std::optional find(U val) -{ - return val; -} - -template - requires (!std::is_same_v && !can_static_cast) -consteval std::optional find(U val) -{ - return {}; -} - -template -consteval std::optional find(T val, auto... vals) -{ - return val; -} - -template - requires (!std::is_same_v && can_static_cast) -consteval std::optional find(U val, auto... vals) -{ - return val; -} - -template - requires (!std::is_same_v && !can_static_cast) -consteval auto find(U val, auto... vals) -{ - return find(vals...); -} - -} // namespace mbuoy - -#endif // MBUOY_FIND_HPP - -- cgit v1.2.3