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

greater_than.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_VALID_IF_GREATER_THAN_HPP
10 #define EAGINE_VALID_IF_GREATER_THAN_HPP
11 
12 #include "decl.hpp"
13 
14 namespace eagine {
15 
16 // greater-than
17 template <typename T, T Cmp>
18 struct valid_if_gt_policy {
19  constexpr auto operator()(T value) const noexcept {
20  return value > Cmp;
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  << "less then or equal to " << Cmp << " "
31  << "is invalid";
32  }
33  };
34 };
35 
36 template <typename T, T Cmp>
37 using valid_if_greater_than = valid_if<T, valid_if_gt_policy<T, Cmp>>;
38 
39 } // namespace eagine
40 
41 #endif // EAGINE_VALID_IF_GREATER_THAN_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).