Skip to content

Ever wanted C++ to be even more unsafe? Figment allows you to control precisely the lifetime of objects of any type.

License

Notifications You must be signed in to change notification settings

luizffgv/Figment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Figment

What is this?

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.

Why the name?

‍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.

Is this safe? Like, at all?

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.

About

Ever wanted C++ to be even more unsafe? Figment allows you to control precisely the lifetime of objects of any type.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages