Figment allows you to control precisely the lifetime of objects of any type. The
fgmnt::figment
class is similar to std::optional
, but it holds no
information about itself.
Figments are subjective in that they are based on personal experiences and perceptions and may not be considered objective or verifiable by others.
– Text generated by GPT-3.5—OpenAI’s large-scale language-generation model—and adapted by me
The basis of Figment is that it's sometimes possible to deduce the state of an object without verifying it. A figment shouldn't be used alongside boolean flags. Any code that can access a figment should be unreachable under any unsafe circumstances. Take for example a class instance: its member variables will never be accessed again once the constructor throws. I bet you can come up with other use cases.
As long as you don't make any mistakes. So definitely not! A figment is fundamentally unsafe and instances should be used with care, and even then it's very easy to fuck everything up. Don't use this library if value your sanity over saving a few bytes.