Counting the number of primes in C and C++11
Idiomatic C++ Review
#include &lt;math.h&gt;

C++ has its own version of math header.
#include &lt;cmath&gt;

Difference is all the functions are placed in the std namespace.
Prefer not to use std::endl.
        std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0] &lt;&lt; &quot; &lt;N&gt;&quot; &lt;&lt; std::endl;

Forcing a flush is not normally what you want to do. The streams will automatically flush when required and doing it manually will only make the code less efficient.
Prefer to put one variable per line. Also for loop counters can be declared inside the for statement (see below).
    size_t i, j, res = 0;

Don't dynamical allocate when a local variable will do:
    std::unique_ptr&lt;std::vector&lt;bool&gt; &gt; sieve(new std::vector&lt;bool&gt;(limit));

    // Should be
    std::vector&lt;bool&gt; sieve(limit);

Also std::vector&lt;bool&gt; is special. It is optimized for space not speed. It also has some other quirks that make it undesirable, so prefer std::vector&lt;char&gt; unless you really really need to save space. BUT because of the space saving you can get better caching which may improve time. In this case presumably because of the size of the vector keeping it as bool makes it much more efficient.
see: Comparing std::vector to std::vector
Declare loop variables inside the for:
    for (i = 2; i &lt;= isqrt; ++i) {

    // Usually written like this:
    for(int i = 2; i &lt;= isqrt; ++i) {

The at() method is a checked access to the member. It validates your index is in range (you don't do this in the C code).
        if (sieve-&gt;at(i)) continue;

Unless you are using unvalidated user input there is little need to use the at() method, prefer to use operator[].
In C++14 the functions std::begin() and std::end() were introduced to get the iterators for containers. You should prefer to use these as they work with arrays as well as the standard containers.
    for_each(sieve-&gt;cbegin() + 2, sieve-&gt;cend(), [&amp;res](bool i) { res += !i; });


    // Can be written as:
    auto begin = std::begin(sieve);
    std::advance(begin, 2);
    for_each(begin, std::end(sieve), [&amp;res](bool i) { res += !i; });

Don't bother with a return at the end of main.
    return 0;