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

gt0_lt1.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_VALID_IF_GT0_LT1_HPP
10 #define EAGINE_VALID_IF_GT0_LT1_HPP
11 
12 #include "decl.hpp"
13 
14 namespace eagine {
15 
16 // in (0, 1)
17 template <typename T>
18 struct valid_if_gt0_lt1_policy {
19  constexpr auto operator()(T value) const noexcept {
20  return (T(0) < value) && (value < T(1));
21  }
22 
23  struct do_log {
24  template <typename X, typename = disable_if_same_t<X, do_log>>
25  constexpr do_log(X&&) noexcept {}
26 
27  template <typename Log>
28  void operator()(Log& log, const T& v) const {
29  log << "Value " << v << ", "
30  << "outside of interval (0,1) is invalid";
31  }
32  };
33 };
34 
35 template <typename T>
36 using valid_if_gt0_lt1 = valid_if<T, valid_if_gt0_lt1_policy<T>>;
37 
38 } // namespace eagine
39 
40 #endif // EAGINE_VALID_IF_GT0_LT1_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21

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