std::chrono::steady_clock::now

static std::chrono::time_point<std::chrono::steady_clock> now(); (since C++11) Returns a time point representing the current point in time. Parameters (none). Return value A time point representing the current time. Exceptions noexcept specification: noexcept Example #include <iostream> #include <vector> #include <numeric> #include <chrono> volatile int sink; int main() { for (auto size = 1ull; size < 1000000000ull; size *= 100) {

std::basic_string::shrink_to_fit

void shrink_to_fit(); (since C++11) Requests the removal of unused capacity. It is a non-binding request to reduce capacity to size. It depends on the implementation if the request is fulfilled. Parameters (none). Return value (none). Complexity Constant. Example #include <iostream> #include <string> int main() { std::string s; std::cout << "Default-constructed capacity is " << s.capacity() << '\n'; s.resize(100); std::cout &

constexpr specifier

constexpr - specifies that the value of a variable or function can appear in constant expressions Explanation The constexpr specifier declares that it is possible to evaluate the value of the function or variable at compile time. Such variables and functions can then be used where only compile time constant expressions are allowed (provided that appropriate function arguments are given). A constexpr specifier used in an object declaration implies const. A constexpr specifier used in a fun

std::basic_stringstream::basic_stringstream

explicit basic_stringstream( ios_base::openmode mode = ios_base::in|ios_base::out ); (1) explicit basic_stringstream( const std::basic_string<CharT,Traits,Allocator>& str, ios_base::openmode mode = ios_base::in|ios_base::out ); (2) basic_stringstream( basic_stringstream&& other ); (3) (since C++11) Constructs new string stream. 1) Constructs new underlying string device. The underlying basic_stringbuf object is constructed as basic_strin

std::basic_streambuf::swap

void swap( basic_streambuf& other ); (since C++11) Exchanges the contents of the stream buffer with those of other. Parameters other - stream buffer to exchange contents with Return value (none). Exceptions (none). Example

std::puts

Defined in header <cstdio> int puts( const char *str ); Writes character string str and a newline to stdout. Parameters str - character string to be written Return value Non-negative number on success or EOF otherwise. See also fputs writes a character string to a file stream (function) printffprintfsprintfsnprintf (C++11) prints formatted output to stdout, a file stream or a buffer (function) C documentation for puts

std::gslice_array

Defined in header <valarray> template< class T > class gslice_array; std::gslice_array is a helper template used by std::gslice subscript operator. It has reference semantics to a subset of the array specified by the std::gslice object. Member types Type Definition value_type T Member functions (constructor) constructs a gslice_array (public member function) (destructor) destroys a gslice_array (public member function) operator= assigns

unsigned

Usage unsigned type modifier

std::getwchar

Defined in header <cwchar> wint_t getwchar(); Reads the next wide character from stdin. Parameters (none). Return value The obtained wide character or WEOF if an error has occurred or the end of file reached. See also getchar reads a character from stdin (function) fgetwcgetwc gets a wide character from a file stream (function) C documentation for getwchar

std::unique_ptr::get

pointer get() const; (since C++11) Returns a pointer to the managed object or nullptr if no object is owned. Parameters (none). Return value Pointer to the managed object or nullptr if no object is owned. Exceptions noexcept specification: noexcept Example #include <iostream> #include <string> #include <memory> int main() { std::unique_ptr<std::string> s_p(new std::string("Hello, world!")); std::string *s = s_p.get(); std::cout <&