/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

www.reedbeta.com
| | playfulprogramming.blogspot.com
3.7 parsecs away

Travel
| | The performance of std::visit came up in a discussion, and my first thought was that from reading generated assembly code, it's a jump tabl...
| | mpark.github.io
4.1 parsecs away

Travel
| | A visitation mechanism for `std::variant`.
| | eyakubovich.github.io
3.2 parsecs away

Travel
| | It's a simple task - you want iterate over all the lines in a file and perform an action on each one. In Python it's as simple as:for line in open("somefile.txt"): print lineHow about C++11. How hard can it be? This stackoverflow post gives us a starting point. We...
| | quuxplusone.github.io
22.7 parsecs away

Travel
| Consider the following example of an "STL-style algorithm," taken from a lab exercise in one of my training courses: template<class It> bool is_palindrome(It first, It last) { while (first != last) { -last; if (first == last) break; if (*first != *last) { return false; } ++first; } return true; } A palindrome is equal to itself when read forwards or backwards, so, I said blithely, we could rewrite it like this: template<class It> bool is_palindrome(It first, It last) { return std::equal( first, last, std::reverse_iterator(last), std::reverse_iterator(first) ); } But look out - this code has a bug that causes undefined behavior! Do you see it?