Currently with apache/mod_ssl, if DHE is enabled then a 1024-bit ephemeral key will be used. I found the following quote in Adam Langley's blog:


  Ideally the DH group would match or exceed the RSA key size but 1024-bit DHE is arguably better than straight 2048-bit RSA so you can get away with that if you want to.


So it appears that he is advocating something like DHE-RSA-AES256-SHA with 1024-bit ephemeral DH keys over AES256-SHA with a 2048-bit RSA key. My understanding is that 1024-bit DH (ephemeral or not) is of comparable security to 1024-bit RSA. Why would he make such a recommendation? Does he value the forward secrecy offered by DHE that much?


Question: How to efficiently delete elements from vector c++
Answer: There's an underused STL algorithm called remove_if that allows you to efficiently (O(n)) remove all elements matching a predicate from a container. It is most useful if you have a vector or deque, because they have an expensive (O(n)) erase operation for an element "in the middle". However, you need to be aware that remove_if doesn't actually erase any element, it only moves all elements that do not match the predicate to the front of the range you specified. The canonical way to do an "erase_if" is therefore (in this example, all odd integers will be erased):


std::vector ints = …;
ints.erase(std::remove_if(begin(ints), end(ints), [](int i) { return i%2 != 0; }), end(ints));


Explanation: remove_if moves all ints not matching the predicate (i.e. the even ints in this example) to the front and returns an iterator one past the last of these elements. Then, we actually erase all elements starting with this one to the end of the vector using the range overload of vector&lt;int&gt;::erase.

E.g., assume we have ints == {5,7,4,10,9,16,20,6}. remove_if will turn ints into {4,10,16,20,6,UNSPEC,UNSPEC,UNSPEC} where I used UNSPEC to denote any unspecified value, and it will also return an iterator pointing to the first UNSPEC element. Then, we erase all the elements with unspecified value and get {4,10,16,20,6}, the desired result.

UPDATE: With respect to the previous answer, I want to point out that remove_if is stable, i.e. it will not change the order of the remaining elements.