Cpp Standard Library 简明教程

C++ Library - <utility>

Introduction

它包含不相关域中的实用程序。

It contains utilities in unrelated domains.

  1. Pairs − these objects can hold two values of different types: pair, make_pair, piecewise_construct, piecewise_construct_t.

  2. Generic relational operators − It is a standard definitions for the relational operators !=, >, ⇐ and >= under a specific namespace: rel_ops.

  3. Rvalue casts (C++11) − It allows the generation of rvalue references: forward, move, move_if_noexcept, declval.

  4. Generic swap function − This a standard definition used by default by the components of the standard library for all types that do not provide their own overload: swap.

Functions

Sr.No.

Function & description

1

swapIt exchanges values of two objects.

2

make_pairIt constructs the pair objects.

3

forwardIt is a forward argument.

4

moveIt moves as rvalue.

5

move_if_noexcept It moves if noexcept.

6

declvalIt is a declaration value.

Constants

Sr.No.

Constant & description

1

piecewise_constructIt is a piecewise construct constant.

Namespaces

Sr.No.

Namespace & description

1

rel_opsIt is a relational Operators.