Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion delegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ using detail::Delegate;
#undef CB_FORWARD

#define __CB_DELEGATE_INIT(instance, func) decltype(CB::detail::create_delegate(func))::bind<func>(instance)
#define __CB_DELEGATE_FF(func) decltype(CB::detail::create_delegate(func))::bind<func>()
#define __CB_DELEGATE_INIT_FF(func) decltype(CB::detail::create_delegate(func))::bind<func>()
#define CB_DELEGATE_INIT __CB_DELEGATE_INIT
#define CB_DELEGATE_FF __CB_DELEGATE_INIT_FF

Expand Down
8 changes: 6 additions & 2 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ int main(int argc, char **argv)
printf("%d\n", b3(5));

}
{
printf("\n");
E d = create_delegate_freefunction();
int val = 41;
printf("%d %d\n",d(val), val);
}

return 0;
}


4 changes: 4 additions & 0 deletions test/routines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ D create_delegate(Value &v)
return d;
}

E create_delegate_freefunction() {
E d = CB_DELEGATE_FF(increment);
return d;
}
6 changes: 6 additions & 0 deletions test/routines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using C = CB::StaticClosure<int (int), 64>;
using C1 = CB::StaticClosure<int (int), 76>;
using D = CB::Delegate<int (int)>;
using E = CB::Delegate<int (int &)>;

struct Value {

Expand All @@ -17,6 +18,11 @@ struct Value {

};

inline int increment(int &val) {
return val++;
}

C create_closure(int init, const char *text);
C1 create_closure2(int init, const char *text);
D create_delegate(Value &v);
E create_delegate_freefunction();