Skip to content

Instantly share code, notes, and snippets.

@AtnNn
Created July 11, 2019 10:26
Show Gist options
  • Save AtnNn/f5e38e60becef30fae2d574b4256fa8d to your computer and use it in GitHub Desktop.
Save AtnNn/f5e38e60becef30fae2d574b4256fa8d to your computer and use it in GitHub Desktop.
Blog idea!
#include <string>
template <auto Name>
struct Int { private: int n; };
struct EI : Int<1>, virtual Int<2> {};
struct DI : virtual Int<2> {};
struct FI : EI, DI {};
struct DC { int a1; int a2; };
struct EC { int a2; };
struct FC : EC, DC {};
int main() {
FI x;
(Int<2>)x; // Ok!
FC y;
y.a2; // Error!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment