-
Recent Posts
Recent Comments
Archives
Categories
Monthly Archives: February 2015
Avoid finding twice the same key in the map (part 2)
Later, I found the following code:
1 2 3 4 5 6 |
auto p = map.find(key); if (p != map.end()) { throw std::runtime_error(...); } prepare(value); map[key] = value; |
Posted in C++, C++11, STL
Leave a comment
Avoid finding twice the same key in the map (part 1)
This is unfortunate, but I regularly still see the following piece of code:
1 2 3 4 5 |
auto p = map.find(key); // (1) if (p != map.end()) { throw std::runtime_error(...); } map[key] = value; // (2) |
Posted in C++, C++11, STL
Leave a comment
An optional member of an optional object
My colleague told me that boost::optional suffers from missing the ability of building an optional of a member from an optional of its parent object.
Posted in boost, C++, C++11, optional
Leave a comment
Firmware alternatif pour router netgear WNDR3700 v1
Insatisfait par les firmware de mon routeur netgear, j’ai décidé d’installer une alternative open source.
Implementing comparators with tuple
C++11 introduces the interesting std::tuple feature. Here, I will present the usage of std::tie to implement comparison operators in a class.
Posted in C++, C++11
Leave a comment