目录

(constructor)

描述 (Description)

它从各种来源构造一个std :: function。

声明 (Declaration)

以下是std :: function的声明。

C++11

以下是创建一个空函数。

function();
function( std::nullptr_t );

异常 (Exceptions)

noexcept:noexcept规范。

复制和移动

以下功能是将其他目标复制或移动到* this的目标。 如果other为空,*调用后也会为空。

function( const function& other );
function( function&& other );

异常 (Exceptions)

noexcept:noexcept规范。

初始化目标

以下函数是使用f的副本初始化目标。 如果f是指向函数的空指针或指向成员的空指针,则*在调用后将为空。 除非f对参数类型为Args并且返回类型为R,否则此构造函数不参与重载决策

template< class F > 
function( F f );

异常 (Exceptions)

noexcept:noexcept规范。

允许记忆

以下函数与仅使用alloc为函数可能使用的任何内部数据结构分配内存相同。

template< class Alloc > 
function( std::allocator_arg_t, const Alloc& alloc );
template< class Alloc > 
function( std::allocator_arg_t, const Alloc& alloc, 
          std::nullptr_t );
template< class Alloc >
function( std::allocator_arg_t, const Alloc& alloc, 
          const function& other );
template< class Alloc > 
function( std::allocator_arg_t, const Alloc& alloc, 
          function&& other );
template< class F, class Alloc > 
function( std::allocator_arg_t, const Alloc& alloc, F f );

异常 (Exceptions)

noexcept:noexcept规范。

参数 (Parameters)

  • other - 此函数对象用于初始化* this。

  • f - 用于初始化* this的callable。

  • alloc - 用于内部内存分配。

↑回到顶部↑
WIKI教程 @2018