Skip to content

Commit 56f0852

Browse files
committed
Added typedef for function pointers
1 parent 4e126aa commit 56f0852

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/problem.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
template <class T, class D>
1313
class Problem
1414
{
15+
/** Typedefs for handling pointer-to-function **/
16+
typedef void (Problem::*ProblemVoidFn)();
17+
typedef D (Problem::*ProblemDataFn)();
18+
typedef bool (Problem::*ProblemBoolFn)();
19+
1520
public:
1621
// Problem<T,D>(std::string fileName);
1722
Problem<T,D>(std::string fileName, int size);
@@ -23,7 +28,7 @@ class Problem
2328
// Setters
2429
void setReadInput(D (*functionPointer)());
2530
void setInitStack(void (*functionPointer)());
26-
void setPopCondition(bool (*functionPointer)());
31+
void setPopCondition(ProblemBoolFn functionPointer);
2732
void setPopAction(void (*functionPointer)());
2833
void setPushCondition(bool (*functionPointer)());
2934
void setPushAction(void (*functionPointer)());
@@ -151,7 +156,7 @@ void Problem<T,D>::setPopAction(void (*functionPointer)()){
151156
mPopAction = functionPointer;
152157
}
153158
template <class T, class D>
154-
void Problem<T,D>::setPopCondition(bool (*functionPointer)()){
159+
void Problem<T,D>::setPopCondition(ProblemBoolFn functionPointer){
155160
mPopConditon = functionPointer;
156161
}
157162
template <class T, class D>

0 commit comments

Comments
 (0)