In C++ is there a preferred way of dealing with a recursive function that reuses an unchanged object every time? For example (pseudo code):
void func(HashMap h, Logger logger, int depth)
{
// Do stuff then call func recursively...
func(h, logger, depth+1);
}
So every call we pass in several objects (hash map and logger) unchanged. Yes we can pass by reference but it still seems inefficient and doesn't look very pretty. The only alternative I can think of is global variables or bundling up the constant parameters in a struct.