SUNphi  1.0
Macros.hpp
Go to the documentation of this file.
1 #ifndef _MACROS_HPP
2 #define _MACROS_HPP
3 
4 /// \file Macros.hpp
5 ///
6 /// \brief Header file to define some usefule macro
7 
8 /// Concatenate two tokens
9 ///
10 /// Internal implementation
11 #define _CONCAT2_IMPL(X,Y)
12  X ## Y
13 
14 /// Concatenate two tokens
15 ///
16 /// Wrapper to beat CPP
17 #define _CONCAT2_WRAP(X,Y)
18  _CONCAT2_IMPL(X,Y)
19 
20 /// Concatenate two tokens
21 ///
22 /// User accessible implementation
23 #define CONCAT2(X,Y)
24  _CONCAT2_WRAP(X,Y)
25 
26 /// Concatenate three tokens
27 #define CONCAT3(X,Y,Z)
28  CONCAT2(CONCAT2(X,Y),Z)
29 
30 /////////////////////////////////////////////////////////////////
31 
32 /// Merges two tokens using a _
33 #define NAME2(X,Y)
34  CONCAT3(X,_,Y)
35 
36 /// Merges three tokens with two _
37 #define NAME3(X,Y,Z)
38  NAME2(X,NAME2(Y,Z))
39 
40 /// Merges four tokens with three _
41 #define NAME4(X,Y,W,Z)
42  NAME2(X,NAME3(Y,W,Z))
43 
44 /// Provides assignment through a simple macro
45 #define PROVIDE_ASSIGNMENT_OPERATOR(PROVIDER)
46  PROVIDER(=)
47 
48 /// Provides all binary operators through a simple macro
49 #define PROVIDE_ALL_BINARY_OPERATORS(PROVIDER)
50  PROVIDER(+=);
51  PROVIDER(-=);
52  PROVIDER(*=);
53  PROVIDER(/=);
54  PROVIDER(+);
55  PROVIDER(-);
56  PROVIDER(*);
57  PROVIDER(/);
58  PROVIDER(==);
59  PROVIDER(!=);
60  PROVIDER(<);
61  PROVIDER(<=);
62  PROVIDER(>);
63  PROVIDER(>=)
64 
65 namespace SUNphi
66 {
67 }
68 
69 #endif
#define NAME2(X, Y)
Merges two tokens using a _.
Definition: Macros.hpp:33
#define _CONCAT2_WRAP(X, Y)
Definition: Macros.hpp:17
#define NAME3(X, Y, Z)
Merges three tokens with two _.
Definition: Macros.hpp:37
#define CONCAT3(X, Y, Z)
Concatenate three tokens.
Definition: Macros.hpp:27
#define CONCAT2(X, Y)
Definition: Macros.hpp:23
#define _CONCAT2_IMPL(X, Y)
Definition: Macros.hpp:11