Bond
 
Loading...
Searching...
No Matches
counter_base.h
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#pragma once
5
6#include <bond/core/config.h>
7
8#include <boost/static_assert.hpp>
9
10#include <type_traits>
11
12namespace bond { namespace ext { namespace detail
13{
15 template <typename T>
17 {
18 public:
19 BOOST_STATIC_ASSERT(std::is_integral<T>::value);
20
21 using value_type = T;
22
23 explicit counter_base(T max_value) BOND_NOEXCEPT
24 : _max_value{ max_value }
25 {}
26
27 counter_base(const counter_base& other) = delete;
28
29 T max_value() const BOND_NOEXCEPT
30 {
31 return _max_value;
32 }
33
34 private:
35 const T _max_value;
36 };
37
38} } } // namespace bond::ext::detail
Helper base class for counters.
Definition: counter_base.h:17
namespace bond
Definition: apply.h:17