Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
chainbase::int_incrementer Class Reference

#include <chainbase.hpp>

Public Member Functions

 int_incrementer (int32_t &target)
 
 ~int_incrementer ()
 
int32_t get () const
 

Detailed Description

The code we want to implement is this:

++target; try { ... } finally { –target }

In C++ the only way to implement finally is to create a class with a destructor, so that's what we do here.

Definition at line 120 of file chainbase.hpp.

Constructor & Destructor Documentation

◆ int_incrementer()

chainbase::int_incrementer::int_incrementer ( int32_t & target)
inline

Definition at line 123 of file chainbase.hpp.

123 : _target(target)
124 { ++_target; }

◆ ~int_incrementer()

chainbase::int_incrementer::~int_incrementer ( )
inline

Definition at line 125 of file chainbase.hpp.

126 { --_target; }

Member Function Documentation

◆ get()

int32_t chainbase::int_incrementer::get ( ) const
inline

Definition at line 128 of file chainbase.hpp.

129 { return _target; }

The documentation for this class was generated from the following file: