I need to make sure that a C ++ function declared as a friend of a particular C ++ class has an internal binding.
The reason I need a function to be a friend is because it needs access to a private member of this class, a private member that caches the result of the function.
The reason that a function must be non-member (or at least not an instance member) of the same class is because other code should be able to use a non-member function pointer. Refactoring it will be too expensive.
The reason I need to have an internal connection is because there will be many of these functions, and on AIX, when too many of them cause a TOC overflow error when binding. This can be overcome with the -bbigtoc linker switch, but I try to avoid this for now.
In addition, I would really like to save the class declaration in the header file, but put this function in the .cxx file containing the implementation.
To summarize, right now I have something like this:
class Foo { private: mutable Qux cachedBarResult;
I want Bar have an internal connection. It can be done?
source share