mirror of
https://github.com/Naios/continuable.git
synced 2026-02-07 02:09:46 +08:00
more tests
This commit is contained in:
parent
dda1357163
commit
9602e5fa26
@ -2,10 +2,42 @@
|
|||||||
#ifndef _FLUENT_HPP_
|
#ifndef _FLUENT_HPP_
|
||||||
#define _FLUENT_HPP_
|
#define _FLUENT_HPP_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "functional_unwrap.hpp"
|
#include "functional_unwrap.hpp"
|
||||||
|
|
||||||
struct fluent_step
|
class fluent_step
|
||||||
{
|
{
|
||||||
|
bool released;
|
||||||
|
|
||||||
|
void release()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
fluent_step() : released(false) { }
|
||||||
|
|
||||||
|
~fluent_step()
|
||||||
|
{
|
||||||
|
if (!released)
|
||||||
|
release();
|
||||||
|
}
|
||||||
|
|
||||||
|
fluent_step(fluent_step const&) = delete;
|
||||||
|
fluent_step(fluent_step&& right) : released(false)
|
||||||
|
{
|
||||||
|
right.released = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluent_step& operator= (fluent_step const&) = delete;
|
||||||
|
fluent_step& operator= (fluent_step&& right)
|
||||||
|
{
|
||||||
|
released = false;
|
||||||
|
right.released = true;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
fluent_step& then(Callback const& callback)
|
fluent_step& then(Callback const& callback)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user