mirror of
https://github.com/Naios/continuable.git
synced 2025-12-07 17:26:47 +08:00
more work
This commit is contained in:
parent
1e565b2c06
commit
7e813ece17
@ -18,6 +18,27 @@
|
||||
#ifndef _CONTINUABLE_H_
|
||||
#define _CONTINUABLE_H_
|
||||
|
||||
#include "Callback.h"
|
||||
|
||||
template <typename _MTy>
|
||||
class ContinuableBase
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
template <typename _ATy, typename _WTy = void>
|
||||
class Continuable;
|
||||
|
||||
template <typename... _ATy>
|
||||
class Continuable<Callback<_ATy...>, void>
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
template <typename... _ATy, typename _WTy>
|
||||
class Continuable<Callback<_ATy...>, _WTy>
|
||||
{
|
||||
static_assert(false, "");
|
||||
};
|
||||
|
||||
#endif /// _CONTINUABLE_H_
|
||||
|
||||
@ -63,23 +63,23 @@ fluent_step make_waterfall()
|
||||
}
|
||||
|
||||
|
||||
struct Continueable
|
||||
struct ProtoContinueable
|
||||
{
|
||||
template <typename Callback>
|
||||
Continueable then(Callback&& callback)
|
||||
ProtoContinueable then(Callback&& callback)
|
||||
{
|
||||
return Continueable();
|
||||
return ProtoContinueable();
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
Continueable weak(Container& container)
|
||||
ProtoContinueable weak(Container& container)
|
||||
{
|
||||
return Continueable();
|
||||
return ProtoContinueable();
|
||||
}
|
||||
|
||||
Continueable strong()
|
||||
ProtoContinueable strong()
|
||||
{
|
||||
return Continueable();
|
||||
return ProtoContinueable();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
12
test.cpp
12
test.cpp
@ -3,24 +3,25 @@
|
||||
|
||||
#include "Callback.h"
|
||||
#include "WeakCallbackContainer.h"
|
||||
#include "Continuable.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
Continueable CastSpell(int id)
|
||||
ProtoContinueable CastSpell(int id)
|
||||
{
|
||||
std::cout << "Cast " << id << std::endl;
|
||||
|
||||
// on success call true
|
||||
return Continueable();
|
||||
return ProtoContinueable();
|
||||
}
|
||||
|
||||
Continueable MoveTo(int point)
|
||||
ProtoContinueable MoveTo(int point)
|
||||
{
|
||||
std::cout << "Move to point " << point << std::endl;
|
||||
|
||||
// on success call true
|
||||
return Continueable();
|
||||
return ProtoContinueable();
|
||||
}
|
||||
|
||||
void CastSpell(int id, Callback<bool> const& callback)
|
||||
@ -146,5 +147,8 @@ int main(int argc, char** argv)
|
||||
wrapped();
|
||||
wrapped2();
|
||||
|
||||
|
||||
typedef Continuable<Callback<bool>> cont;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user