diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-14 02:18:46 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-14 02:18:46 +0100 |
| commit | 2448ac2ef13d96e4ef3b7a9a15ef1cfdc2195831 (patch) | |
| tree | 55a4ab28858813722f926dc3a21ffdf7795aced6 /include | |
| parent | 3b336edafad6fecbe41b9485d80cdd247ac70d0e (diff) | |
chore: `option.hpp` improvements, new examples in `examples`.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/ocl/option.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/ocl/option.hpp b/include/ocl/option.hpp index c1bc5cc..d84e935 100644 --- a/include/ocl/option.hpp +++ b/include/ocl/option.hpp @@ -69,7 +69,8 @@ namespace ocl { struct int_eq_teller final { - bool operator()(int a, int b) + template <class ObjFirst, class ObjLast> + bool operator()(ObjFirst a, ObjLast b) { return (a == b); } @@ -77,7 +78,8 @@ namespace ocl struct int_greater_than_teller final { - bool operator()(int a, int b) + template <class ObjFirst, class ObjLast> + bool operator()(ObjFirst a, ObjLast b) { return (a > b); } @@ -85,7 +87,8 @@ namespace ocl struct int_less_than_teller final { - bool operator()(int a, int b) + template <class ObjFirst, class ObjLast> + bool operator()(ObjFirst a, ObjLast b) { return (a < b); } @@ -95,22 +98,19 @@ namespace ocl template <typename... Lst> inline return_type eval_less_than(Lst&&... arg) { - static detail::int_less_than_teller eq; - return eq(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; + return detail::int_less_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } template <typename... Lst> inline return_type eval_eq(Lst&&... arg) { - static detail::int_eq_teller less_than; - return less_than(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; + return detail::int_eq_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } template <typename... Lst> inline return_type eval_greater_than(Lst&&... arg) { - static detail::int_greater_than_teller greater_than; - return greater_than(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; + return detail::int_greater_than_teller{}(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } inline return_type eval_true() noexcept |
