Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1#pragma once
2#include <stdio.h>
3
4struct Reg {
5 int r_;
6 Reg(int r) : r_(r) {}
7};
8
9inline const Reg& getReg0() { static const Reg r(0); return r; }
10inline const Reg& getReg1() { static const Reg r(1); return r; }
11inline const Reg& getReg2() { static const Reg r(2); return r; }
12
13static const Reg& r0 = getReg0();
14static const Reg& r1 = getReg1();
15static const Reg& r2 = getReg2();
16
17inline void putReg()
18{
19 puts("putReg");
20 printf("r0=%p, %d\n", &r0, r0.r_);
21 printf("r0=%p, %d\n", &r0, r1.r_);
22 printf("r0=%p, %d\n", &r0, r2.r_);
23}
24
25struct A {
26 int a;
27 A()
28 : a(5)
29 {
30 puts("A cstr");
31 }
33 {
34 puts("A dstr");
35 }
36 void put() const
37 {
38 printf("a=%d\n", a);
39 }
40};
41
42template<int dummy = 0>
43struct XT {
44 static A a;
45};
46
47template<int dummy>
49
50typedef XT<0> X;
51
52void init();
53
54struct Init {
56 {
57 puts("Init");
58 init();
59 putReg();
60 }
61};
62static Init s_init;
63
const mie::Vuint & r
Definition bn.cpp:28
void init()
Definition lib_test.cpp:3
void putReg()
Definition lib.h:17
XT< 0 > X
Definition lib.h:50
const Reg & getReg1()
Definition lib.h:10
const Reg & getReg2()
Definition lib.h:11
const Reg & getReg0()
Definition lib.h:9
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
A()
Definition lib.h:27
int a
Definition lib.h:26
~A()
Definition lib.h:32
void put() const
Definition lib.h:36
Definition lib.h:54
Init()
Definition lib.h:55
Definition lib.h:4
int r_
Definition lib.h:5
Reg(int r)
Definition lib.h:6
Definition lib.h:43
static A a
Definition lib.h:44