Skip to content

Instantly share code, notes, and snippets.

View dmitshur's full-sized avatar

Dmitri Shuralyov dmitshur

View GitHub Profile
@dmitshur
dmitshur / MutuallyConnectable.h
Last active October 8, 2015 08:48
When you want classes A and B to be mutually connected to each other, derive them from this class template.
#pragma once
#ifndef __MutuallyConnectable_H__
#define __MutuallyConnectable_H__
// Usage: Suppose you want to have two classes A and B that are mutually connected to each other.
//
// Derive the class A from MutuallyConnectable<A, B> where A is the class you're deriving
// and B is the other class you want to make mutual connections with.
// Derive the class B from MutuallyConnectable<B, A>.
//