C POSIX library#regex.h. General-purpose smart pointers C++11 provides , and improvements to and from TR1. is deprecated. Extensible random number facility The C standard library provides the ability to generate pseudorandom numbers via the function rand. However, the algorithm is delegated entirely to the library vendor. C++ inherited this functionality with no changes, but C++11 provides a new method for generating pseudorandom numbers. C++11's random number functionality is split into two parts: a generator engine that contains the random number generator's state and produces the pseudorandom numbers; and a distribution, which determines the range and mathematical distribution of the outcome. These two are combined to form a random number generator object. Unlike the C standard rand, the C++11 mechanism will come with three base generator engine algorithms: linear_congruential_engine, subtract_with_carry_engine, and mersenne_twister_engine. C++11 also provides a number of standard distributions: uniform_int_distribution, uniform_real_distribution, bernoulli_distribution, binomial_distribution, geometric_distribution, negative_binomial_distribution, poisson_distribution, exponential_distribution, gamma_distribution, weibull_distribution, extreme_value_distribution, normal_distribution, lognormal_distribution, chi_squared_distribution, cauchy_distribution, fisher_f_distribution, student_t_distribution, discrete_distribution, piecewise_constant_distribution and piecewise_linear_distribution. The generator and distributions are combined as in this example: #include <random> #include <functional> std::uniform_int_distribution<int> distribution(0, 99); std::mt19937 engine; // Mersenne twister MT19937 auto generator = std::bind(distribution, engine); int random = generator(); // Generate a uniform integral variate between 0 and 99. int random2 = distribution(engine); // Generate another sample directly using the distribution and the engine objects. Wrapper reference A wrapper reference is obtained from an instance of the template class reference_wrapper. Wrapper references are similar to normal references (‘&’) of the C++ language. To obtain a wrapper reference from any object the function template ref is used (for a constant reference cref is used). Wrapper references are useful above all for function templates, where references to parameters rather than copies are needed: // This function will take a reference to the parameter 'r' and increment it. void func (int &r) { r++; } // Template function. template<class F, class P> void g (F f, P t) { f(t); } int main() { int i = 0; g (func, i); // 'g<void (int &r), int>' is instantiated // then 'i' will not be modified. std::cout << i << std::endl; // Output -> 0 g (func, std::ref(i)); // 'g<void(int &r),reference_wrapper<int>>' is instantiated // then 'i' will be modified. std::cout << i << std::endl; // Output -> 1 } This new utility was added to the existing <utility> header and didn't need further extensions of the C++ language. Polymorphic wrappers for