RhythmGame 1.4.3
Loading...
Searching...
No Matches
EnableSharedFromBase.h
Go to the documentation of this file.
1//
2// Created by bobini on 15.10.22.
3//
4
5#ifndef RHYTHMGAME_ENABLESHAREDFROMBASE_H
6#define RHYTHMGAME_ENABLESHAREDFROMBASE_H
7#include <memory>
8
13namespace support {
22template<class Base>
23class EnableSharedFromBase : public std::enable_shared_from_this<Base>
24{
25 protected:
26 template<class Derived>
27 auto sharedFromBase() -> std::shared_ptr<Derived>
28 {
29 return std::static_pointer_cast<Derived>(this->shared_from_this());
30 }
31};
32
33} // namespace support
34#endif // RHYTHMGAME_ENABLESHAREDFROMBASE_H
A helper class for creating a shared pointer to self.
Definition EnableSharedFromBase.h:24
auto sharedFromBase() -> std::shared_ptr< Derived >
Definition EnableSharedFromBase.h:27
Contains various helper classes and functions.
Definition Capitalize.h:9