Skip to content

jeffmachyo/Lazy-Singleton-in-CPP-with-Shared_Ptr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lazy-Singleton-in-CPP-with-Shared_Ptr

This repo demonstrates the creation of a thread-safe Lazy Singleton in CPP using shared pointers.

  • A singleton pattern is a creational design pattern that restricts the instantiation of a class to an instance. With this implementation, smart pointers are used to reference the singleton class and thus prevent memory leaks. The implementation is also thread safe. which ensures that the whole instance method is executed in a single thread.

Build: g++ -o main main.cpp Singleton.cpp

About

This repo demonstrates the creation of a thread-safe Lazy Singleton in CPP using shared pointers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages