Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace {
- std::map<std::string, void(*)(complex_stack &)> op = {
- { "+", [](complex_stack &st) {
- complex x, y;
- extract(st, x, y);
- st = st << (x + y);
- }},
- { "-", [](complex_stack &st) {
- complex x, y;
- extract(st, x, y);
- st = st << (y - x);
- }},
- { "*", [](complex_stack &st) {
- complex x, y;
- extract(st, x, y);
- st = st << (x * y);
- }},
- { "/", [](complex_stack &st) {
- complex x, y;
- extract(st, x, y);
- st = st << (y / x);
- }},
- { "!", [](complex_stack &st) {
- complex x = +st;
- st = st << x;
- }},
- { ";", [](complex_stack &st) {
- st = ~st;
- }},
- { "~", [](complex_stack &st) {
- complex x;
- extract(st, x);
- st = st << (~x);
- }},
- { "#", [](complex_stack &st) {
- complex x;
- extract(st, x);
- st = st << (-x);
- }}
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement