forked from jeff-hykin/better-cpp-syntax
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.cpp
More file actions
61 lines (47 loc) · 1.35 KB
/
demo.cpp
File metadata and controls
61 lines (47 loc) · 1.35 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
using namespace std;
// should higlight thing and name
namespace scoped::thing::name {};
// multiple inheritance
struct thing :
public A,
public B,
{};
// operator overloads not marked as functions
int operator+(string base, int repetitions) {
return 7;
};
// should higlight the "..."
template<typename... Args>
// should be blue
int iterate(int thing, thing arg2) { }
int main(char arg_num, char** vargs) {
// the and's should all be the same
int a = 1 and 0;
int b = true and (1);
int c = (true) and (c > 1);
// member access
window.MV.translate(0,0.5,0);
a_pointer.*thread;
a_pointer->thread;
a_pointer->*thread;
a_pointer.thread.thing;
a_pointer.*thread.*thing;
data.push_back(c);
// lambda syntax
auto d = [&, a](thing arg1, thing arg2) -> int {
return 0;
}
unsigned long thing = 100Ul ;
auto custom_literal = 100feet ;
auto hex_floating_point = 0xAB.cdp5 ;
auto tickmarks_are_allowed = 0x0.53'84'92p10 ;
// this is messed up because the tick ^ isnt escaped
// this shouldn't be green
// templated functions
auto f = bitset(input);
auto e = bitset<8>(input);
#error Don't make errors
int this_shouldnt_be_green2 = 1;
return 0;
}