0

I was browsing through code and came across an interesting way of writing a return statement and I am wondering if someone could help me understand what this code is doing and what it would look like in a different format. the code is this:

bool Maze::EqualityCheck(std::string & str_1, std::string & str_2) {
    return (
    (str_1.size() == str_2.size()) && equal(str_1.begin(), str_1.end(), str_2.begin(), [](char & c1, char & c2) {
      return (c1 == c2 || toupper(c1) == toupper(c2));
    })
  );
}

I have never seen anything like this before and I am hoping to gain insight on this novelty (to me) thank you.

NathanOliver
  • 150,499
  • 26
  • 240
  • 331

0 Answers0