game.cpp:25:17: warning: unnecessary parentheses in declaration of '_val' [-Wparentheses]
25 | node(_val)
| ^
game.cpp:25:18: error: field '_val' has incomplete type 'segment_tree_2d::segment_tree::node'
25 | node(_val)
| ^~~~
game.cpp:15:16: note: definition of 'struct segment_tree_2d::segment_tree::node' is not complete until the closing brace
15 | struct node
| ^~~~
game.cpp:30:13: error: expected ';' at end of member declaration
30 | }
| ^
| ;
game.cpp: In constructor 'segment_tree_2d::segment_tree::segment_tree()':
game.cpp:39:18: error: no match for 'operator=' (operand types are 'segment_tree_2d::segment_tree' and 'std::nullptr_t')
39 | *l = nullptr;
| ^~~~~~~
game.cpp:13:12: note: candidate: 'constexpr segment_tree_2d::segment_tree& segment_tree_2d::segment_tree::operator=(const segment_tree_2d::segment_tree&)'
13 | struct segment_tree
| ^~~~~~~~~~~~
game.cpp:13:12: note: no known conversion for argument 1 from 'std::nullptr_t' to 'const segment_tree_2d::segment_tree&'
game.cpp:13:12: note: candidate: 'constexpr segment_tree_2d::segment_tree& segment_tree_2d::segment_tree::operator=(segment_tree_2d::segment_tree&&)'
game.cpp:13:12: note: no known conversion for argument 1 from 'std::nullptr_t' to 'segment_tree_2d::segment_tree&&'
game.cpp:40:18: error: no match for 'operator=' (operand types are 'segment_tree_2d::segment_tree' and 'std::nullptr_t')
40 | *r = nullptr;
| ^~~~~~~
game.cpp:13:12: note: candidate: 'constexpr segment_tree_2d::segment_tree& segment_tree_2d::segment_tree::operator=(const segment_tree_2d::segment_tree&)'
13 | struct segment_tree
| ^~~~~~~~~~~~
game.cpp:13:12: note: no known conversion for argument 1 from 'std::nullptr_t' to 'const segment_tree_2d::segment_tree&'
game.cpp:13:12: note: candidate: 'constexpr segment_tree_2d::segment_tree& segment_tree_2d::segment_tree::operator=(segment_tree_2d::segment_tree&&)'
game.cpp:13:12: note: no known conversion for argument 1 from 'std::nullptr_t' to 'segment_tree_2d::segment_tree&&'
game.cpp: In member function 'void segment_tree_2d::segment_tree::update(segment_tree_2d::segment_tree::node*, int, int, int, int)':
game.cpp:71:30: error: base operand of '->' is not a pointer
71 | tree -> val = (l -> val) + (r -> val); /// merge?
| ^~
game.cpp:71:43: error: base operand of '->' is not a pointer
71 | tree -> val = (l -> val) + (r -> val); /// merge?
| ^~
game.cpp: In member function 'void segment_tree_2d::segment_tree::update(int, int)':
game.cpp:85:26: error: 'n' was not declared in this scope
85 | update(1, 1, n, pos, x);
| ^
game.cpp: In member function 'int segment_tree_2d::segment_tree::query(int, int)':
game.cpp:89:32: error: 'n' was not declared in this scope
89 | return query(1, 1, n, ql, qr);
| ^
game.cpp: In member function 'void segment_tree_2d::merge_tree(segment_tree_2d::segment_tree*, int)':
game.cpp:107:37: error: no matching function for call to 'segment_tree_2d::segment_tree::query()'
107 | int fh = tree -> l -> query()
| ^
game.cpp:74:13: note: candidate: 'int segment_tree_2d::segment_tree::query(segment_tree_2d::segment_tree::node*, int, int, int, int)'
74 | int query(node *tree, int l, int r, int ql, int qr)
| ^~~~~
game.cpp:74:13: note: candidate expects 5 arguments, 0 provided
game.cpp:87:13: note: candidate: 'int segment_tree_2d::segment_tree::query(int, int)'
87 | int query(int ql, int qr)
| ^~~~~
game.cpp:87:13: note: candidate expects 2 arguments, 0 provided
game.cpp:107:13: warning: unused variable 'fh' [-Wunused-variable]
107 | int fh = tree -> l -> query()
| ^~