Message from C, C++ discussions

January 2020

— Most of the paradigms in C++ is a Turing complete even generic


Also i dont think you can compare pattern matching to a switch statement, as a switch statement is pretty much nothing else than a table where to jump to

— Ahahah this code looks to crazy:))

— And pattern matching
Is an automatic table that is made from diamond and steel

— Wat

— I'm creating a priority queue of pair<int,string> which stores the elements based on the value of int and if they are equal then compare the string

Message permanent page

— Here is the code:

class cmp
bool operator()(pair<int, string> &x, pair<int, string> &y)
if (x.first != y.first)
return x.first < y.first;
return x.second < y.second;

priority_queue< pair<int,string>, vector<pair<int,string>>, cmp> q;
q.push({1, "coding"});
q.push({2, "love"});
q.push({2, "i"});
q.push({1, "leetcode"});
pair<int,string> p =;

Message permanent page

— Output:


— Why is "love" and "i" coming first in the output

— My comparator should put the element first which has smaller int and if that clashes then put the smaller string(lexicographically) first

Message permanent page

— Hey does anyone know to properly interface a c++ program with Arduino via serial communication?? I have done it but it is not accurate the tx and rx pins blink when am sending data through the serial port but most of the time the Arduino doesn't do anything I programmed it to do!!

Message permanent page

— Do you use correct band?