more work

This commit is contained in:
Denis Blank 2015-06-10 15:38:11 +02:00 committed by Naios
parent 1e565b2c06
commit 7e813ece17
3 changed files with 36 additions and 11 deletions

View File

@ -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_

View File

@ -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();
}
};

View File

@ -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;
}