As a newbie to C++, I came across many challenges when working on a project with this versatile language. Learn by doing, these blogs (Learn C++) are the record of practical examples I collected.

I was confused by the following line, when reading the implementation of logger in TensorRT examples.

LogStreamConsumer gLogFatal{LOG_FATAL(gLogger)};
  1. LogStreamConsumer is a class used for handling log messages or streams.

  2. gLogFatal is an instance of the LogStreamConsumer class. It is being initialized with the result of LOG_FATAL(gLogger).

  3. LOG_FATAL is a inline function customize the gLogger

  4. gLogger is an instance of a Logger class or object.

  5. Initialization: The uniform initialization syntax is used: type var_name{arg1, arg2, ....arg n}

The gLogFatal object is being initialized with the result of calling LOG_FATAL with gLogger as an argument. This suggests that LOG_FATAL is constructing a LogStreamConsumer object, possibly based on the severity level of gLogger.