OGLplus  (0.59.0) a C++ wrapper for rendering APIs

args_within_limits.hpp
Go to the documentation of this file.
1 #ifndef EAGINE_ARGS_WITHIN_LIMITS_HPP
9 #define EAGINE_ARGS_WITHIN_LIMITS_HPP
10 
11 #include "is_within_limits.hpp"
12 #include <algorithm>
13 
14 namespace eagine {
15 //------------------------------------------------------------------------------
16 template <typename... Params, typename... Args>
17 static constexpr auto args_within_limits_of(const Args&... args) noexcept
18  -> std::enable_if_t<sizeof...(Params) == sizeof...(Args), bool> {
19  return (... && is_within_limits<std::decay_t<Params>>(args));
20 }
21 //------------------------------------------------------------------------------
22 template <typename RV, typename... Params, typename... Args>
23 static constexpr auto
24 args_within_limits(RV (*)(Params...), const Args&... args) noexcept -> bool {
25  return args_within_limits_of<Params...>(args...);
26 }
27 //------------------------------------------------------------------------------
28 template <typename RV, typename Cls, typename... Params, typename... Args>
29 static constexpr auto
30 args_within_limits(RV (Cls::*)(Params...), const Args&... args) noexcept
31  -> bool {
32  return args_within_limits_of<Params...>(args...);
33 }
34 //------------------------------------------------------------------------------
35 template <typename RV, typename Cls, typename... Params, typename... Args>
36 static constexpr auto args_within_limits(
37  RV (Cls::*)(Params...) noexcept,
38  const Args&... args) noexcept -> bool {
39  return args_within_limits_of<Params...>(args...);
40 }
41 //------------------------------------------------------------------------------
42 template <typename RV, typename Cls, typename... Params, typename... Args>
43 static constexpr auto
44 args_within_limits(RV (Cls::*)(Params...) const, const Args&... args) noexcept
45  -> bool {
46  return args_within_limits_of<Params...>(args...);
47 }
48 //------------------------------------------------------------------------------
49 template <typename RV, typename Cls, typename... Params, typename... Args>
50 static constexpr auto args_within_limits(
51  RV (Cls::*)(Params...) const noexcept,
52  const Args&... args) noexcept -> bool {
53  return args_within_limits_of<Params...>(args...);
54 }
55 //------------------------------------------------------------------------------
56 } // namespace eagine
57 
58 #endif // EAGINE_ARGS_WITHIN_LIMITS_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
static constexpr auto is_within_limits(Src value) noexcept
Indicates if value fits into the specified Dst type.
Definition: is_within_limits.hpp:122

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).