pilotclient icon indicating copy to clipboard operation
pilotclient copied to clipboard

CLogCategoryList easier to construct in static member functions

Open oktal3700 opened this issue 5 years ago • 0 comments

The normal use case of CLogMessage and CStatusMessage involves implicit construction of the CLogCategoryList from the caller's this pointer. The value of the pointer doesn't matter, only its type is used to obtain the categories by reflection.

Obviously this is not available in static member functions. Currently there are two workarounds:

  1. Just call the static getLogCategories(), which is incorrect (doesn't use reflection).
  2. static_cast<Class*>(nullptr), which is correct but cumbersome.

We need a better way to construct a CLogCategoryList for a class, without access to a this pointer.

oktal3700 avatar Jun 07 '20 20:06 oktal3700