How bad is meta-programming still today? - Peter Gottschling - Meeting C++ 2016
New Video from Meeting C++ 2016:
How bad is meta-programming still today?
Peter Gottschling
June 16-21, Sofia, Bulgaria
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 16-21, Kona, HI, USA
By Meeting C++ | Jan 12, 2017 09:47 AM | Tags: tmp meta-programming intermediate c++14 c++11 advanced
New Video from Meeting C++ 2016:
How bad is meta-programming still today?
Peter Gottschling
By Jason Turner | Jan 12, 2017 09:40 AM | Tags: intermediate c++14
Episode 45 of C++ Weekly.
Compile Time Maze Generator (and Solver)
by Jason Turner
About the show:
In this episode Jason demonstrates how to build a random maze generator (and solver) that can be executed at compile time with constexpr.
By Marco Arena | Jan 12, 2017 08:07 AM | Tags: visual studio
The Visual C++ Team is asking for your feedback on vcpkg:
vcpkg 3 Months Anniversary, Survey
by Eric Mittelette
Link to the survey:
Visual C++ Survey - Vcpkg
From the article:
vcpkg, a tool to acquire and build C++ open source libraries on Windows, was published 3 months ago. We started with 20 libraries and now the C++ community has added 121 new C++ libraries...
By Andrey Karpov | Jan 12, 2017 05:41 AM | Tags: static code analysis pvs-studio c++
PVS-Studio is a static code analyzer, that searches for errors and vulnerabilities in programs written in C, C++ and C#. In this article, I am going to uncover the technologies that we use in PVS-Studio analyzer. In addition to the general theoretical information, I will show practical examples of how certain technology allows the detection of bugs.
How PVS-Studio does the bug search: methods and technologies
by Andrey Karpov
From the article:
The definition of the pattern looks quite simple, but in practice the implementation of the diagnostic is quite complicated. It's not enough just to analyze only "#define RShift(a) a >> 3". If warnings are issued for all strings of this kind, there will be too many of them. We should have a look at the way the macro expands in every particular case, and try to define the situations where it was done intentionally, and when the brackets are really missing.
By Adrien Hamelin | Jan 11, 2017 12:59 PM | Tags: intermediate experimental
Sorting can be done many ways.
A “sorted view”
by Nick Athanasiou
From the article:
This installment elaborates on the creation of a “sorted_view” utility. The “References” section contains links to the complete code; throughout the article, we provide demos and snippets to showcase and explain the implementations. The section on modernizing the code contains real world applications of the following C++17 features:
- structured bindings
- template argument deduction for class templates
By Adrien Hamelin | Jan 11, 2017 12:56 PM | Tags: performance intermediate
It seems a simple problem, yet…
Applying a permutation to a vector, part 6
by Raymond Chen
From the article:
I left an exercise to write a function apply_reverse_permutation in which each element in the indices represents where the element should move to rather than where it comes from...
By Adrien Hamelin | Jan 11, 2017 12:54 PM | Tags: performance intermediate
It seems a simple problem, yet…
Applying a permutation to a vector, part 5
by Raymond Chen
From the article:
Our apply_permutation function assumes that the integers form a valid permutation. Let's add error checking...
By Jonas Devlieghere | Jan 11, 2017 04:17 AM | Tags: performance intermediate
How ordering members can impact performance.
Order Your Members
by Jonas Devlieghere
From the article:
The article highlights the impact that different choices regarding the ordering of members in a struct can have on the performance of your code. A lot can be achieved by taking into account some general guidelines.
By Adrien Hamelin | Jan 10, 2017 02:24 PM | Tags: intermediate boost
Undefined behaviour can be dangerous.
(Not) detecting bugs
by Andrzej Krzemieński
From the article:
The following code contains a bug. A developer has spent quite some time looking for the source. The intent of this code is to iterate over two vectors simultaneously, from the first up to the one-before-last element. Thus the most interesting tools that will be employed will be boost::zip_iterator and std::prev.
#include <boost/iterator/zip_iterator.hpp> #include <boost/tuple/tuple.hpp> #include <vector> using zip_iter = boost::zip_iterator< boost::tuple< std::vector<int>::iterator, std::vector<int>::iterator > >; int main() { std::vector<int> v1 = {1, 2, 3, 4, 0}; std::vector<int> v2 = {2, 3, 5, 7, 0}; zip_iter beg {boost::make_tuple(v1.begin(), v2.begin())}; zip_iter end {boost::make_tuple(v1.end(), v2.end())}; auto process = [](zip_iter::reference){}; std::for_each(beg, std::prev(end), process); }
By Adrien Hamelin | Jan 10, 2017 02:19 PM | Tags: performance intermediate
Why constness is important in one article. Can be even better with
constexpr
.
Add a const here, delete a const there…
by Bruce Dawson
From the article:
I just completed a series of changes that shrunk the Chrome browser’s on-disk size on Windows by over a megabyte, moved about 500 KB of data from its read/write data segments to its read-only data segments, and reduced its private working set by about 200 KB per-process. The amusing thing about this series of changes is that they consisted entirely of removing const from some places, and adding const to others. Compilers be weird...