Last active
April 16, 2024 23:30
-
-
Save define-private-public/e93c4bbb89482d5d07e36eed104f92a2 to your computer and use it in GitHub Desktop.
C++ `final` keyword experiment (TODO blog link)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
option(WITH_FINAL "Use the `final` specifier on derived classes (faster?)" OFF) | |
# ... | |
if (WITH_FINAL) | |
message(STATUS "Using `final` spicifer (faster?)") | |
target_compile_definitions(PSRayTracing_StaticLibrary PUBLIC USE_FINAL) | |
else() | |
message(STATUS "Turned off use of `final` (slower?)") | |
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef USE_FINAL | |
#define FINAL final | |
#else | |
#define FINAL | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rg FINAL | |
RandomGenerator.hpp | |
185:class RandomGenerator FINAL : public _GeneralizedRandomGenerator<std::uniform_real_distribution, rreal, RNG_ENGINE> { | |
Materials/Lambertian.hpp | |
8:class Lambertian FINAL : public IMaterial { | |
... | |
Materials/SurfaceNormal.hpp | |
7:class SurfaceNormal FINAL : public IMaterial { | |
... | |
PDFs/HittablePDF.hpp | |
7:class HittablePDF FINAL : public IPDF { | |
... | |
Objects/Sphere.hpp | |
19:class Sphere FINAL : public IHittable { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment