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

within_limits.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_VALID_IF_WITHIN_LIMITS_HPP
10 #define EAGINE_VALID_IF_WITHIN_LIMITS_HPP
11 
12 #include "../is_within_limits.hpp"
13 #include "decl.hpp"
14 
15 namespace eagine {
16 
19 template <typename Dst, typename Src>
21 
23  constexpr auto operator()(Src value) const noexcept {
24  return is_within_limits<Dst>(value);
25  }
26 
27  struct do_log {
28  template <typename X, typename = disable_if_same_t<X, do_log>>
29  constexpr do_log(X&&) noexcept {}
30 
31  template <typename Log>
32  void operator()(Log& log, const Src& v) const {
33  log << "Value " << v << ", "
34  << "not within limits of destination type "
35  << "is invalid";
36  }
37  };
38 };
39 
44 template <typename Dst, typename Src>
47 
48 } // namespace eagine
49 
50 #endif // EAGINE_VALID_IF_WITHIN_LIMITS_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
Primary template for conditionally valid values.
Definition: decl.hpp:49
Policy class for values valid if they are withing limits of other type.
Definition: within_limits.hpp:20
constexpr auto operator()(Src value) const noexcept
Indicates value validity, true if value fits into Dst type.
Definition: within_limits.hpp:23
valid_if< Src, valid_if_within_limits_policy< Dst, Src > > valid_if_within_limits
Specialization of valid_if, for values valid if within limits of Dst type.
Definition: within_limits.hpp:46

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