@anonymous/

HatefulMadeupMicrostation

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  template<typename T>
  class Badge {
      friend T;
      Badge() {}
      Badge(const Badge&) {}
      Badge(Badge&&) {}
  };

  template<typename T>
  Badge<T> FakeBadge() {
    static struct Stub {} stub;
    return *(Badge<T>*)&stub;
  };

  class Device {
  public:
    static Badge<Device> getBadge() { return Badge<Device>(); }
  };

  void needDeviceBadge(Badge<Device> badge)
  {
  }

  int main()
  {
     needDeviceBadge(Device::getBadge());
     needDeviceBadge(FakeBadge<Device>());
     return 0;
  }