79676978

Date: 2025-06-24 03:53:25
Score: 2
Natty:
Report link

Let's try this.

class UseBindlessTexturesInitializer {
public:
  UseBindlessTexturesInitializer() : value_(0) {
    // Do more initialization
  }

  bool value() const { return value_; }
private:
  bool value_;
};

bool getUseBindlessTextures() {
  static UseBindlessTexturesInitializer v{};
  return v.value();
}

This isn't the neatest way to do this but quite easy and safe. Take a look at Is local static variable initialization thread-safe in C++11?

Reasons:
  • Whitelisted phrase (-1): try this
  • Probably link only (1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Simon. Li