Initial commit

This commit is contained in:
Segey Lapin
2021-07-31 03:30:12 +03:00
commit 91cf9d2d34
249 changed files with 27582 additions and 0 deletions

34
modules/meshops/functor.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef FUNCTOR_H
#define FUNCTOR_H
template <class T, class S>
struct functor {
void *obj;
typedef void (T::*_memfunc)(S);
_memfunc func;
functor(void *obj, _memfunc func)
{
this->obj = obj;
this->func = func;
}
functor()
{
obj = 0;
}
operator bool() const
{
return !!obj;
}
void operator()(S item)
{
run(*this, item);
}
static void run(functor &ftor, S item)
{
T *obj = (T *)ftor.obj;
_memfunc func = ftor.func;
(obj->*func)(item);
}
};
#endif