A
A
I have a functor which looks like this:
struct TLocalRecursiveF
{
void operator()(int *P1, std::vector<TStruct*> &S1)
{
P1++;
S1.push_back(TStruct());
this->operator()(P1, S1);
}
} RecursiveF;
RecursiveF(P0, S0);
Now, ignore for a sec the meaninglessness of this functor. In reality it is
a tree node builder.
It works fine but I am wondering, is this prefered to doing something like
this:
struct TLocal
{
static void RecursFunc(int *P1, std::vector<TStruct*> &S1)
{
P1++;
S1.push_back(TStruct());
RecursFunc(P1, S1);
}
};
TLocal::RecursFunc(P0, S0);
Is one version preferred over another or faster over another?
struct TLocalRecursiveF
{
void operator()(int *P1, std::vector<TStruct*> &S1)
{
P1++;
S1.push_back(TStruct());
this->operator()(P1, S1);
}
} RecursiveF;
RecursiveF(P0, S0);
Now, ignore for a sec the meaninglessness of this functor. In reality it is
a tree node builder.
It works fine but I am wondering, is this prefered to doing something like
this:
struct TLocal
{
static void RecursFunc(int *P1, std::vector<TStruct*> &S1)
{
P1++;
S1.push_back(TStruct());
RecursFunc(P1, S1);
}
};
TLocal::RecursFunc(P0, S0);
Is one version preferred over another or faster over another?