Skip to content

Instantly share code, notes, and snippets.


Michael Adams mdadams

View GitHub Profile
mdadams / access_to_private_members_1.cpp
Created February 2, 2017 01:40
An example of private member access without friendship in C++
View access_to_private_members_1.cpp
// This example is a variation on the code posted by Dave Abrahams at:
#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);