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
namespace Pattern { | |
template <typename... TArgs> class Observable; | |
template <typename... TArgs> class Observer { | |
virtual void notify(TArgs... args) = 0; | |
friend class Observable<TArgs...>; | |
public: | |
virtual ~Observer() {} | |
}; |
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
Device device = new Device(); | |
VertexBuffer* buffer = device->CreateVertexBuffer(); | |
Mesh* mesh = new Mesh(buffer); | |
// ... |
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
#include <memory> | |
int main() | |
{ | |
// Create the device, buffer and a mesh | |
auto device = std::unique_ptr<Device>(new Device()); | |
auto buffer = device->CreateVertexBuffer(); | |
auto mesh = std::unique_ptr<Mesh>(new Mesh(buffer.get())); | |
// ... Doing a bunch of stuff |
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
int main() | |
{ | |
// Create the device, buffer and a mesh | |
auto device = new Device(); | |
auto buffer = device->CreateVertexBuffer(); | |
auto mesh = new Mesh(buffer); | |
// ... Doing a bunch of stuff | |
// Cleanup |
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
int main() | |
{ | |
// Create the device, buffer and a mesh | |
auto device = new Device(); | |
auto buffer = device->CreateVertexBuffer(); | |
auto mesh = new Mesh(buffer); | |
// ... Doing a bunch of stuff | |
// Cleanup |
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
class Device | |
{ | |
public: | |
Device(); | |
~Device(); | |
VertexBuffer* CreateVertexBuffer(const VertexDescription& desc); | |
// ... | |
}; | |
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
class Mesh | |
{ | |
public: | |
Mesh(const VertexBuffer* const buffer); | |
~Mesh(); | |
}; |
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
#include <memory> | |
class Device | |
{ | |
public: | |
Device(); | |
~Device(); | |
std::unique_ptr<VertexBuffer> CreateVertexBuffer(const VertexDescription& desc); | |
}; |