STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
_Func_class< _Ret, _Types > Class Template Reference
Inheritance diagram for _Func_class< _Ret, _Types >:
_Fun_class_base< _Ret, _Types...>

Public Types

typedef _Func_class< _Ret, _Types...> _Myt
 
typedef _Func_base< _Ret, _Types...> _Ptrt
 
typedef _Ret result_type
 

Public Member Functions

 _Func_class ()
 
_Ret operator() (_Types..._Args) const
 
bool _Empty () const
 
 ~_Func_class () _NOEXCEPT
 

Protected Member Functions

void _Reset ()
 
void _Reset (const _Myt &_Right)
 
void _Resetm (_Myt &&_Right)
 
template<class _Fty >
void _Reset (_Fty &&_Val)
 
template<class _Fty , class _Alloc >
void _Reset_alloc (_Fty &&_Val, _Alloc _Ax)
 
template<class _Fret , class _Farg0 >
void _Reset (_Fret _Farg0::*const _Val)
 
template<class _Fret , class _Farg0 , class _Alloc >
void _Reset_alloc (_Fret _Farg0::*const _Val, _Alloc _Ax)
 
void _Tidy ()
 
void _Swap (_Myt &_Right)
 
const _XSTD2 type_info_Target_type () const
 
const void_Target (const _XSTD2 type_info &_Info) const
 

Private Types

typedef void(* _Pfnty) ()
 

Private Member Functions

template<class _Myimpl , class _Fty , class _Alloc >
void _Do_alloc (_Fty &&_Val, _Alloc _Ax)
 
void _Set (_Ptrt *_Ptr)
 
bool _Local () const
 

Private Attributes

union {
   _Pfnty   _Pfn [3]
 
   void *   _Pobj [3]
 
   long double   _Ldbl
 
   char   _Alias [3 *sizeof(void *)]
 
_Space
 
_Ptrt_Impl
 

Member Typedef Documentation

template<class _Ret , class... _Types>
typedef _Func_class<_Ret, _Types...> _Func_class< _Ret, _Types >::_Myt
template<class _Ret , class... _Types>
typedef void(* _Func_class< _Ret, _Types >::_Pfnty) ()
private
template<class _Ret , class... _Types>
typedef _Func_base<_Ret, _Types...> _Func_class< _Ret, _Types >::_Ptrt
template<class _Ret , class... _Types>
typedef _Ret _Func_class< _Ret, _Types >::result_type

Constructor & Destructor Documentation

template<class _Ret , class... _Types>
_Func_class< _Ret, _Types >::_Func_class ( )
inline
307  : _Impl(0)
308  { // construct without stored object
309  }
_Ptrt * _Impl
Definition: functional:528
template<class _Ret , class... _Types>
_Func_class< _Ret, _Types >::~_Func_class ( )
inline
324  { // destroy the object
325  _Tidy();
326  }
void _Tidy()
Definition: functional:445

Member Function Documentation

template<class _Ret , class... _Types>
template<class _Myimpl , class _Fty , class _Alloc >
void _Func_class< _Ret, _Types >::_Do_alloc ( _Fty &&  _Val,
_Alloc  _Ax 
)
inlineprivate
487  { // store copy of _Val with allocator
488  if (!_Test_callable(_Val))
489  { // null member pointer/function pointer/std::function
490  _Set(0);
491  return;
492  }
493  void *_Vptr = 0;
494  _Myimpl *_Ptr = 0;
495  if (sizeof (_Myimpl) <= sizeof (_Space))
496  { // small enough, allocate locally
497  _Vptr = &_Space;
498  _Ptr = ::new (_Vptr) _Myimpl(_STD forward<_Fty>(_Val));
499  }
500  else
501  { // use allocator
502  typename _Alloc::template rebind<_Myimpl>::other _Al = _Ax;
503  _Vptr = _Al.allocate(1);
504  _Ptr = ::new (_Vptr) _Myimpl(_STD forward<_Fty>(_Val), _Al);
505  }
506  _Set(_Ptr);
507  }
else
Definition: vccorlib.h:1721
union _Func_class::@90 _Space
void _Set(_Ptrt *_Ptr)
Definition: functional:509
bool _Test_callable(_Ty &_Arg, true_type)
Definition: functional:278
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ret , class... _Types>
bool _Func_class< _Ret, _Types >::_Empty ( ) const
inline
319  { // return true if no stored object
320  return (_Impl == 0);
321  }
_Ptrt * _Impl
Definition: functional:528
template<class _Ret , class... _Types>
bool _Func_class< _Ret, _Types >::_Local ( ) const
inlineprivate
515  { // test for locally stored copy of object
516  return ((void *)_Impl == (void *)&_Space);
517  }
_Ptrt * _Impl
Definition: functional:528
union _Func_class::@90 _Space
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Reset ( )
inlineprotected
330  { // remove stored object
331  _Set(0);
332  }
void _Set(_Ptrt *_Ptr)
Definition: functional:509
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Reset ( const _Myt _Right)
inlineprotected
335  { // copy _Right's stored object
336  if (_Right._Impl == 0)
337  _Set(0);
338  else if (_Right._Local())
339  _Set(_Right._Impl->_Copy((void *)&_Space));
340  else
341  _Set(_Right._Impl->_Copy(0));
342  }
union _Func_class::@90 _Space
void _Set(_Ptrt *_Ptr)
Definition: functional:509
const _Ty & _Right
Definition: algorithm:4087
template<class _Ret , class... _Types>
template<class _Fty >
void _Func_class< _Ret, _Types >::_Reset ( _Fty &&  _Val)
inlineprotected
384  { // store copy of _Val
385  _Reset_alloc(_STD forward<_Fty>(_Val), allocator<_Myt>());
386  }
void _Reset_alloc(_Fty &&_Val, _Alloc _Ax)
Definition: functional:390
Definition: iosfwd:611
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ret , class... _Types>
template<class _Fret , class _Farg0 >
void _Func_class< _Ret, _Types >::_Reset ( _Fret _Farg0::*const  _Val)
inlineprotected
402  { // store copy of _Val
404  }
void _Reset_alloc(_Fty &&_Val, _Alloc _Ax)
Definition: functional:390
Definition: iosfwd:611
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ret , class... _Types>
template<class _Fty , class _Alloc >
void _Func_class< _Ret, _Types >::_Reset_alloc ( _Fty &&  _Val,
_Alloc  _Ax 
)
inlineprotected
391  { // store copy of _Val with allocator
393  _MyWrapper;
394  typedef _Func_impl<_MyWrapper, _Alloc, _Ret, _Types...> _Myimpl;
395 
396  _Do_alloc<_Myimpl>(_STD forward<_Fty>(_Val), _Ax);
397  }
Definition: xrefwrap:261
Definition: functional:163
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ret , class... _Types>
template<class _Fret , class _Farg0 , class _Alloc >
void _Func_class< _Ret, _Types >::_Reset_alloc ( _Fret _Farg0::*const  _Val,
_Alloc  _Ax 
)
inlineprotected
410  { // store copy of _Val with allocator
412  _MyWrapper;
414  _Myimpl;
415 
416  _Do_alloc<_Myimpl>(_Val, _Ax);
417  }
Definition: xrefwrap:236
Definition: functional:163
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Resetm ( _Myt &&  _Right)
inlineprotected
345  { // move _Right's stored object
346  if (_Right._Impl == 0)
347  _Set(0);
348  else if (_Right._Local())
349  { // move and tidy
350  _Set(_Right._Impl->_Move((void *)&_Space));
351  _Right._Tidy();
352  }
353  else
354  { // steal from _Right
355  _Set(_Right._Impl);
356  _Right._Set(0);
357  }
358  }
union _Func_class::@90 _Space
void _Set(_Ptrt *_Ptr)
Definition: functional:509
const _Ty & _Right
Definition: algorithm:4087
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Set ( _Ptrt _Ptr)
inlineprivate
510  { // store pointer to object
511  _Impl = _Ptr;
512  }
_Ptrt * _Impl
Definition: functional:528
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Swap ( _Myt _Right)
inlineprotected
455  { // swap contents with contents of _Right
456  if (this == &_Right)
457  ; // same object, do nothing
458  else if (!_Local() && !_Right._Local())
459  _STD swap(_Impl, _Right._Impl); // just swap pointers
460  else
461  { // do three-way copy
462  _Myt _Temp;
463  _Temp._Resetm(_STD forward<_Myt>(*this));
464  _Tidy();
465  _Resetm(_STD forward<_Myt>(_Right));
466  _Right._Tidy();
467  _Right._Resetm(_STD forward<_Myt>(_Temp));
468  }
469  }
_Ptrt * _Impl
Definition: functional:528
void _Resetm(_Myt &&_Right)
Definition: functional:344
_Func_class< _Ret, _Types...> _Myt
Definition: functional:302
void _Tidy()
Definition: functional:445
void swap(function< _Fty > &_Left, function< _Fty > &_Right)
Definition: functional:753
bool _Local() const
Definition: functional:514
const _Ty & _Right
Definition: algorithm:4087
template<class _Ret , class... _Types>
const void* _Func_class< _Ret, _Types >::_Target ( const _XSTD2 type_info _Info) const
inlineprotected
477  { // return pointer to stored object
478  return (_Impl ? _Impl->_Target(_Info) : 0);
479  }
_Ptrt * _Impl
Definition: functional:528
const void * _Target(const _XSTD2 type_info &_Info) const
Definition: functional:145
template<class _Ret , class... _Types>
const _XSTD2 type_info& _Func_class< _Ret, _Types >::_Target_type ( ) const
inlineprotected
472  { // return type information for stored object
473  return (_Impl ? _Impl->_Target_type() : typeid(void));
474  }
_Ptrt * _Impl
Definition: functional:528
typedef void(__cdecl *_se_translator_function)(unsigned int
virtual const _XSTD2 type_info & _Target_type() const =0
template<class _Ret , class... _Types>
void _Func_class< _Ret, _Types >::_Tidy ( )
inlineprotected
446  { // clean up
447  if (_Impl != 0)
448  { // destroy callable object and maybe delete it
450  _Impl = 0;
451  }
452  }
_Ptrt * _Impl
Definition: functional:528
virtual void _Delete_this(bool)=0
bool _Local() const
Definition: functional:514
template<class _Ret , class... _Types>
_Ret _Func_class< _Ret, _Types >::operator() ( _Types...  _Args) const
inline
312  { // call through stored object
313  if (_Impl == 0)
314  _Xbad_function_call();
315  return (_Impl->_Do_call(_STD forward<_Types>(_Args)...));
316  }
_Ptrt * _Impl
Definition: functional:528
virtual _Rx _Do_call(_Types &&...)=0

Member Data Documentation

template<class _Ret , class... _Types>
char _Func_class< _Ret, _Types >::_Alias[3 *sizeof(void *)]
template<class _Ret , class... _Types>
_Ptrt* _Func_class< _Ret, _Types >::_Impl
private
template<class _Ret , class... _Types>
long double _Func_class< _Ret, _Types >::_Ldbl
template<class _Ret , class... _Types>
_Pfnty _Func_class< _Ret, _Types >::_Pfn[3]
template<class _Ret , class... _Types>
void* _Func_class< _Ret, _Types >::_Pobj[3]
union { ... } _Func_class< _Ret, _Types >::_Space

The documentation for this class was generated from the following file: