diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-02 06:14:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-02 06:14:31 -0500 |
| commit | 92d95762c9cf75d9493ec75042c9415b382f10b0 (patch) | |
| tree | dfcbd5b3fb9303e40b32db34cc857243df86ffc9 /include/ocl/core/option.hpp | |
| parent | a28d3e2e4e99793cf91f919d9341f5e07aa998e1 (diff) | |
| parent | bea0e3e713751e5c2a4d2d4343d8215333eef03e (diff) | |
Merge pull request #37 from amlel-el-mahrouss/developv1
chore: module source code tweaks and improvements.
Diffstat (limited to 'include/ocl/core/option.hpp')
| -rw-r--r-- | include/ocl/core/option.hpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/include/ocl/core/option.hpp b/include/ocl/core/option.hpp index e333dd5..b5a2778 100644 --- a/include/ocl/core/option.hpp +++ b/include/ocl/core/option.hpp @@ -23,15 +23,17 @@ namespace ocl template <typename char_type = char> struct option final { - explicit option(const return_type& return_type) + option() = delete; + + option(const return_type& return_type) : ret_(return_type) { } ~option() = default; - option& operator=(const option&) = default; - option(const option&) = default; + option& operator=(const option&) = delete; + option(const option&) = delete; option& expect(const char_type* input) { @@ -65,7 +67,7 @@ namespace ocl return tell(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } - namespace traits + namespace detail { struct int_eq_teller { @@ -90,26 +92,26 @@ namespace ocl return (a < b); } }; - } // namespace traits + } // namespace detail template <typename... Lst> inline return_type eval_less_than(Lst&&... arg) { - static traits::int_less_than_teller eq; + static detail::int_less_than_teller eq; return eq(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } template <typename... Lst> inline return_type eval_eq(Lst&&... arg) { - static traits::int_eq_teller less_than; + static detail::int_eq_teller less_than; return less_than(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } template <typename... Lst> inline return_type eval_greater_than(Lst&&... arg) { - static traits::int_greater_than_teller greater_than; + static detail::int_greater_than_teller greater_than; return greater_than(std::forward<Lst>(arg)...) ? return_type::okay : return_type::err; } @@ -122,6 +124,11 @@ namespace ocl { return return_type::err; } + + inline return_type eval_invalid() noexcept + { + return return_type::invalid; + } } // namespace ocl #endif /* ifndef _OCL_OPT_HPP */
\ No newline at end of file |
