Constraints and concepts

This page describes an experimental core language feature. For named type requirements used in the specification of the standard library, see library concepts. Class templates, function templates, and non-template functions (typically members of class templates) may be associated with a constraint, which specifies the requirements on template arguments, which can be used to select the most appropriate function overloads and template specializations. Constraints may also be used to limit automat

Class template

A class template defines a family of classes. Syntax template < parameter-list > class-declaration (1) export template < parameter-list > class-declaration (2) (until C++11) Explanation class-declaration - a class declaration. The class name declared become a template name. parameter-list - a non-empty comma-separated list of the template parameters, each of which is either non-type parameter, a type parameter, a template parameter, or a parameter pack

std::is_sorted_until

Defined in header <algorithm> template< class ForwardIt > ForwardIt is_sorted_until( ForwardIt first, ForwardIt last ); (1) (since C++11) template< class ForwardIt, class Compare > ForwardIt is_sorted_until( ForwardIt first, ForwardIt last, Compare comp ); (2) (since C++11) Examines the range [first, last) and finds the largest range beginning at first in which the elements are sorted in ascending order. The first version of the

std::isgraph

Defined in header <cctype> int isgraph( int ch ); Checks if the given character is graphic (has a graphical representation) as classified by the currently installed C locale. In the default C locale, the following characters are graphic: digits (0123456789) uppercase letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ) lowercase letters (abcdefghijklmnopqrstuvwxyz) punctuation characters (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~) The behavior is undefined if the value of ch is

std::rethrow_if_nested

Defined in header <exception> template< class E > void rethrow_if_nested( const E& e ); (since C++11) If E is not a polymorphic class type, does nothing. Otherwise, if dynamic_cast<const std::nested_exception&>(e) would succeed (i.e., if E or the dynamic type (the most derived type) of the object referenced by e is std::nested_exception or publicly and unambiguously derived from std::nested_exception), extracts and throws the nested exception as if by ca

std::log

Defined in header <cmath> float log( float arg ); (1) double log( double arg ); (2) long double log( long double arg ); (3) double log( Integral arg ); (4) (since C++11) 1-3) Computes the the natural (base e) logarithm of arg. 4) A set of overloads or a function template accepting an argument of any integral type. Equivalent to 2) (the argument is cast to double). Parameters arg - value of floating-point or Integral type Retu

delete expression

Destructs object(s) previously allocated by the new expression and releases obtained memory area. Syntax ::(optional) delete    expression (1) ::(optional) delete [] expression (2) 1) Destroys one non-array object created by a new-expression 2) Destroys an array created by a new[]-expression Explanation For the first (non-array) form, expression must be a pointer to a complete object type or a class type contextually implicitly convertible to such pointer, and its value

std::cos

Defined in header <cmath> float cos( float arg ); (1) double cos( double arg ); (2) long double cos( long double arg ); (3) double cos( Integral arg ); (4) (since C++11) Computes the cosine of arg (measured in radians). 4) A set of overloads or a function template accepting an argument of any integral type. Equivalent to 2) (the argument is cast to double). Parameters arg - value representing angle in radians, of a floating-point o

std::calloc

Defined in header <cstdlib> void* calloc( std::size_t num, std::size_t size ); Allocates memory for an array of num objects of size size and initializes it to all bits zero. If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any object type. If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access

std::expm1

Defined in header <cmath> float expm1( float arg ); (1) (since C++11) double expm1( double arg ); (2) (since C++11) long double expm1( long double arg ); (3) (since C++11) double expm1( Integral arg ); (4) (since C++11) 1-3) Computes the e (Euler's number, 2.7182818) raised to the given power arg, minus 1.0. This function is more accurate than the expression std::exp(arg)-1.0 if arg is close to zero. 4) A set of overloads or a function te