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

count.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_COUNT_HPP
10 #define EAGINE_COUNT_HPP
11 
12 namespace eagine {
13 
16 template <typename Int = int>
17 class count_t {
18 public:
20  using value_type = Int;
21 
23  constexpr count_t() noexcept = default;
24 
26  constexpr value_type value() const noexcept {
27  return _c;
28  }
29 
32  constexpr operator value_type() const noexcept {
33  return _c;
34  }
35 
38  template <typename... P>
39  constexpr void operator()(const P&...) noexcept {
40  ++_c;
41  }
42 
43 private:
44  Int _c{Int(0)};
45 };
46 
47 } // namespace eagine
48 
49 #endif // EAGINE_COUNT_HPP
constexpr value_type value() const noexcept
Returns the current value on the counter.
Definition: count.hpp:26
Class counting invocation of its call operator.
Definition: count.hpp:17
Common code is placed in this namespace.
Definition: eagine.hpp:21
constexpr void operator()(const P &...) noexcept
Call operator incrementing the counter state.
Definition: count.hpp:39
constexpr count_t() noexcept=default
Default construction, initializes counter to zero.
Int value_type
The value type alias.
Definition: count.hpp:20

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