Skip to content

Instantly share code, notes, and snippets.

@mdadams
mdadams / access_to_private_members_1.cpp
Created February 2, 2017 01:40
An example of private member access without friendship in C++
// This example is a variation on the code posted by Dave Abrahams at:
// https://gist.github.com/1528856.
#include <iostream>
template <typename Tag>
typename Tag::type saved_private_v;
template <typename Tag, typename Tag::type x>
bool save_private_v = (saved_private_v<Tag> = x);