mirror of git://gcc.gnu.org/git/gcc.git
functional: Formatting fixes.
2007-03-25 Paolo Carlini <pcarlini@suse.de> * include/tr1/functional: Formatting fixes. From-SVN: r123199
This commit is contained in:
parent
a5ad201780
commit
cdbd119b94
|
|
@ -1,3 +1,7 @@
|
||||||
|
2007-03-25 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* include/tr1/functional: Formatting fixes.
|
||||||
|
|
||||||
2007-03-23 Paolo Carlini <pcarlini@suse.de>
|
2007-03-23 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
* testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc:
|
* testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc:
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Has_result_type
|
struct _Has_result_type
|
||||||
: integral_constant<
|
: integral_constant<bool,
|
||||||
bool,
|
|
||||||
_Has_result_type_helper<typename remove_cv<_Tp>::type>::value>
|
_Has_result_type_helper<typename remove_cv<_Tp>::type>::value>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
|
@ -517,7 +516,9 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
_Tp* _M_data;
|
_Tp* _M_data;
|
||||||
public:
|
public:
|
||||||
typedef _Tp type;
|
typedef _Tp type;
|
||||||
explicit reference_wrapper(_Tp& __indata): _M_data(&__indata)
|
|
||||||
|
explicit
|
||||||
|
reference_wrapper(_Tp& __indata): _M_data(&__indata)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
reference_wrapper(const reference_wrapper<_Tp>& __inref):
|
reference_wrapper(const reference_wrapper<_Tp>& __inref):
|
||||||
|
|
@ -637,16 +638,19 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
||||||
|
|
||||||
// Handle objects
|
// Handle objects
|
||||||
_Res operator()(_Class& __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(_Class& __object, _ArgTypes... __args) const
|
||||||
{ return (__object.*__pmf)(__args...); }
|
{ return (__object.*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle pointers
|
// Handle pointers
|
||||||
_Res operator()(_Class* __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(_Class* __object, _ArgTypes... __args) const
|
||||||
{ return (__object->*__pmf)(__args...); }
|
{ return (__object->*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle smart pointers, references and pointers to derived
|
// Handle smart pointers, references and pointers to derived
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
_Res operator()(_Tp& __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(_Tp& __object, _ArgTypes... __args) const
|
||||||
{ return _M_call(__object, &__object, __args...); }
|
{ return _M_call(__object, &__object, __args...); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -682,11 +686,13 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
||||||
|
|
||||||
// Handle objects
|
// Handle objects
|
||||||
_Res operator()(const _Class& __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(const _Class& __object, _ArgTypes... __args) const
|
||||||
{ return (__object.*__pmf)(__args...); }
|
{ return (__object.*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle pointers
|
// Handle pointers
|
||||||
_Res operator()(const _Class* __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(const _Class* __object, _ArgTypes... __args) const
|
||||||
{ return (__object->*__pmf)(__args...); }
|
{ return (__object->*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle smart pointers, references and pointers to derived
|
// Handle smart pointers, references and pointers to derived
|
||||||
|
|
@ -727,16 +733,19 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
|
||||||
|
|
||||||
// Handle objects
|
// Handle objects
|
||||||
_Res operator()(volatile _Class& __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(volatile _Class& __object, _ArgTypes... __args) const
|
||||||
{ return (__object.*__pmf)(__args...); }
|
{ return (__object.*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle pointers
|
// Handle pointers
|
||||||
_Res operator()(volatile _Class* __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(volatile _Class* __object, _ArgTypes... __args) const
|
||||||
{ return (__object->*__pmf)(__args...); }
|
{ return (__object->*__pmf)(__args...); }
|
||||||
|
|
||||||
// Handle smart pointers, references and pointers to derived
|
// Handle smart pointers, references and pointers to derived
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
_Res operator()(_Tp& __object, _ArgTypes... __args) const
|
_Res
|
||||||
|
operator()(_Tp& __object, _ArgTypes... __args) const
|
||||||
{ return _M_call(__object, &__object, __args...); }
|
{ return _M_call(__object, &__object, __args...); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -837,8 +846,7 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
public:
|
public:
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Result_type
|
struct _Result_type
|
||||||
: _Mem_fn_const_or_non<
|
: _Mem_fn_const_or_non<_Res,
|
||||||
_Res,
|
|
||||||
(sizeof(__sfinae_types::__two)
|
(sizeof(__sfinae_types::__two)
|
||||||
== sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))>
|
== sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))>
|
||||||
{ };
|
{ };
|
||||||
|
|
@ -854,17 +862,21 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
struct result<_CVMem(_Tp&)>
|
struct result<_CVMem(_Tp&)>
|
||||||
: public _Result_type<_Tp> { };
|
: public _Result_type<_Tp> { };
|
||||||
|
|
||||||
explicit _Mem_fn(_Res _Class::*__pm) : __pm(__pm) { }
|
explicit
|
||||||
|
_Mem_fn(_Res _Class::*__pm) : __pm(__pm) { }
|
||||||
|
|
||||||
// Handle objects
|
// Handle objects
|
||||||
_Res& operator()(_Class& __object) const
|
_Res&
|
||||||
|
operator()(_Class& __object) const
|
||||||
{ return __object.*__pm; }
|
{ return __object.*__pm; }
|
||||||
|
|
||||||
const _Res& operator()(const _Class& __object) const
|
const _Res&
|
||||||
|
operator()(const _Class& __object) const
|
||||||
{ return __object.*__pm; }
|
{ return __object.*__pm; }
|
||||||
|
|
||||||
// Handle pointers
|
// Handle pointers
|
||||||
_Res& operator()(_Class* __object) const
|
_Res&
|
||||||
|
operator()(_Class* __object) const
|
||||||
{ return __object->*__pm; }
|
{ return __object->*__pm; }
|
||||||
|
|
||||||
const _Res&
|
const _Res&
|
||||||
|
|
@ -1105,11 +1117,12 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
|
|
||||||
template<typename _CVArg, typename... _Args>
|
template<typename _CVArg, typename... _Args>
|
||||||
typename result_of<_CVArg(_Args...)>::type
|
typename result_of<_CVArg(_Args...)>::type
|
||||||
operator()(_CVArg& __arg, const tuple<_Args...>& __tuple)
|
operator()(_CVArg& __arg,
|
||||||
const volatile
|
const tuple<_Args...>& __tuple) const volatile
|
||||||
{
|
{
|
||||||
// Construct an index tuple and forward to __call
|
// Construct an index tuple and forward to __call
|
||||||
typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indexes;
|
typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
|
||||||
|
_Indexes;
|
||||||
return this->__call(__arg, __tuple, _Indexes());
|
return this->__call(__arg, __tuple, _Indexes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1144,8 +1157,9 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
// Add a reference, if it hasn't already been done for us.
|
// Add a reference, if it hasn't already been done for us.
|
||||||
// This allows us to be a little bit sloppy in constructing
|
// This allows us to be a little bit sloppy in constructing
|
||||||
// the tuple that we pass to result_of<...>.
|
// the tuple that we pass to result_of<...>.
|
||||||
typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value - 1),
|
typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value
|
||||||
_Tuple>::type __base_type;
|
- 1), _Tuple>::type
|
||||||
|
__base_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename add_reference<__base_type>::type type;
|
typedef typename add_reference<__base_type>::type type;
|
||||||
|
|
@ -1155,7 +1169,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
typename result<_Mu(_Arg, _Tuple)>::type
|
typename result<_Mu(_Arg, _Tuple)>::type
|
||||||
operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile
|
operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile
|
||||||
{
|
{
|
||||||
return ::std::_GLIBCXX_TR1::get<(is_placeholder<_Arg>::value - 1)>(__tuple);
|
return ::std::_GLIBCXX_TR1::get<(is_placeholder<_Arg>::value
|
||||||
|
- 1)>(__tuple);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1180,7 +1195,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
|
|
||||||
// Pick up the cv-qualifiers of the argument
|
// Pick up the cv-qualifiers of the argument
|
||||||
template<typename _CVArg, typename _Tuple>
|
template<typename _CVArg, typename _Tuple>
|
||||||
_CVArg& operator()(_CVArg& __arg, const _Tuple&) const volatile
|
_CVArg&
|
||||||
|
operator()(_CVArg& __arg, const _Tuple&) const volatile
|
||||||
{ return __arg; }
|
{ return __arg; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1195,7 +1211,10 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
struct _Maybe_wrap_member_pointer
|
struct _Maybe_wrap_member_pointer
|
||||||
{
|
{
|
||||||
typedef _Tp type;
|
typedef _Tp type;
|
||||||
static const _Tp& __do_wrap(const _Tp& __x) { return __x; }
|
|
||||||
|
static const _Tp&
|
||||||
|
__do_wrap(const _Tp& __x)
|
||||||
|
{ return __x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1209,7 +1228,10 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
struct _Maybe_wrap_member_pointer<_Tp _Class::*>
|
struct _Maybe_wrap_member_pointer<_Tp _Class::*>
|
||||||
{
|
{
|
||||||
typedef _Mem_fn<_Tp _Class::*> type;
|
typedef _Mem_fn<_Tp _Class::*> type;
|
||||||
static type __do_wrap(_Tp _Class::* __pm) { return type(__pm); }
|
|
||||||
|
static type
|
||||||
|
__do_wrap(_Tp _Class::* __pm)
|
||||||
|
{ return type(__pm); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1393,7 +1415,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
public:
|
public:
|
||||||
typedef _Result result_type;
|
typedef _Result result_type;
|
||||||
|
|
||||||
explicit _Bind_result(_Functor __f, _Bound_args... __bound_args)
|
explicit
|
||||||
|
_Bind_result(_Functor __f, _Bound_args... __bound_args)
|
||||||
: _M_f(__f), _M_bound_args(__bound_args...) { }
|
: _M_f(__f), _M_bound_args(__bound_args...) { }
|
||||||
|
|
||||||
// Call unqualified
|
// Call unqualified
|
||||||
|
|
@ -1412,7 +1435,6 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return this->__call(_GLIBCXX_TR1::tie(__args...), _Bound_indexes());
|
return this->__call(_GLIBCXX_TR1::tie(__args...), _Bound_indexes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call as volatile
|
// Call as volatile
|
||||||
template<typename... _Args>
|
template<typename... _Args>
|
||||||
result_type
|
result_type
|
||||||
|
|
@ -1421,7 +1443,6 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return this->__call(_GLIBCXX_TR1::tie(__args...), _Bound_indexes());
|
return this->__call(_GLIBCXX_TR1::tie(__args...), _Bound_indexes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call as const volatile
|
// Call as const volatile
|
||||||
template<typename... _Args>
|
template<typename... _Args>
|
||||||
result_type
|
result_type
|
||||||
|
|
@ -1523,14 +1544,19 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
void (_Undefined_class::*_M_member_pointer)();
|
void (_Undefined_class::*_M_member_pointer)();
|
||||||
};
|
};
|
||||||
|
|
||||||
union _Any_data {
|
union _Any_data
|
||||||
|
{
|
||||||
void* _M_access() { return &_M_pod_data[0]; }
|
void* _M_access() { return &_M_pod_data[0]; }
|
||||||
const void* _M_access() const { return &_M_pod_data[0]; }
|
const void* _M_access() const { return &_M_pod_data[0]; }
|
||||||
|
|
||||||
template<typename _Tp> _Tp& _M_access()
|
template<typename _Tp>
|
||||||
|
_Tp&
|
||||||
|
_M_access()
|
||||||
{ return *static_cast<_Tp*>(_M_access()); }
|
{ return *static_cast<_Tp*>(_M_access()); }
|
||||||
|
|
||||||
template<typename _Tp> const _Tp& _M_access() const
|
template<typename _Tp>
|
||||||
|
const _Tp&
|
||||||
|
_M_access() const
|
||||||
{ return *static_cast<const _Tp*>(_M_access()); }
|
{ return *static_cast<const _Tp*>(_M_access()); }
|
||||||
|
|
||||||
_Nocopy_types _M_unused;
|
_Nocopy_types _M_unused;
|
||||||
|
|
@ -1599,10 +1625,12 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
&& sizeof(_Functor) <= _M_max_size
|
&& sizeof(_Functor) <= _M_max_size
|
||||||
&& __alignof__(_Functor) <= _M_max_align
|
&& __alignof__(_Functor) <= _M_max_align
|
||||||
&& (_M_max_align % __alignof__(_Functor) == 0));
|
&& (_M_max_align % __alignof__(_Functor) == 0));
|
||||||
|
|
||||||
typedef integral_constant<bool, __stored_locally> _Local_storage;
|
typedef integral_constant<bool, __stored_locally> _Local_storage;
|
||||||
|
|
||||||
// Retrieve a pointer to the function object
|
// Retrieve a pointer to the function object
|
||||||
static _Functor* _M_get_pointer(const _Any_data& __source)
|
static _Functor*
|
||||||
|
_M_get_pointer(const _Any_data& __source)
|
||||||
{
|
{
|
||||||
const _Functor* __ptr =
|
const _Functor* __ptr =
|
||||||
__stored_locally? &__source._M_access<_Functor>()
|
__stored_locally? &__source._M_access<_Functor>()
|
||||||
|
|
@ -1647,7 +1675,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
||||||
_Manager_operation __op)
|
_Manager_operation __op)
|
||||||
{
|
{
|
||||||
switch (__op) {
|
switch (__op)
|
||||||
|
{
|
||||||
case __get_type_info:
|
case __get_type_info:
|
||||||
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1725,7 +1754,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
||||||
_Manager_operation __op)
|
_Manager_operation __op)
|
||||||
{
|
{
|
||||||
switch (__op) {
|
switch (__op)
|
||||||
|
{
|
||||||
case __get_type_info:
|
case __get_type_info:
|
||||||
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1754,10 +1784,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
~_Function_base()
|
~_Function_base()
|
||||||
{
|
{
|
||||||
if (_M_manager)
|
if (_M_manager)
|
||||||
{
|
|
||||||
_M_manager(_M_functor, _M_functor, __destroy_functor);
|
_M_manager(_M_functor, _M_functor, __destroy_functor);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool _M_empty() const { return !_M_manager; }
|
bool _M_empty() const { return !_M_manager; }
|
||||||
|
|
@ -1779,7 +1807,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
typedef _Function_base::_Base_manager<_Functor> _Base;
|
typedef _Function_base::_Base_manager<_Functor> _Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static _Res
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
return (*_Base::_M_get_pointer(__functor))(__args...);
|
return (*_Base::_M_get_pointer(__functor))(__args...);
|
||||||
}
|
}
|
||||||
|
|
@ -1792,7 +1821,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
typedef _Function_base::_Base_manager<_Functor> _Base;
|
typedef _Function_base::_Base_manager<_Functor> _Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static void
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
(*_Base::_M_get_pointer(__functor))(__args...);
|
(*_Base::_M_get_pointer(__functor))(__args...);
|
||||||
}
|
}
|
||||||
|
|
@ -1805,7 +1835,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
typedef _Function_base::_Ref_manager<_Functor> _Base;
|
typedef _Function_base::_Ref_manager<_Functor> _Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static _Res
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
|
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
|
||||||
|
|
@ -1819,7 +1850,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
typedef _Function_base::_Ref_manager<_Functor> _Base;
|
typedef _Function_base::_Ref_manager<_Functor> _Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static void
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
|
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
|
||||||
}
|
}
|
||||||
|
|
@ -1834,9 +1866,11 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
_Base;
|
_Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static _Res
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
return _GLIBCXX_TR1::mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
|
return _GLIBCXX_TR1::
|
||||||
|
mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1854,7 +1888,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
_M_manager(_Any_data& __dest, const _Any_data& __source,
|
||||||
_Manager_operation __op)
|
_Manager_operation __op)
|
||||||
{
|
{
|
||||||
switch (__op) {
|
switch (__op)
|
||||||
|
{
|
||||||
case __get_type_info:
|
case __get_type_info:
|
||||||
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
__dest._M_access<const type_info*>() = &typeid(_Functor);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1870,9 +1905,11 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
static void
|
||||||
|
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
|
||||||
{
|
{
|
||||||
_GLIBCXX_TR1::mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
|
_GLIBCXX_TR1::
|
||||||
|
mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1963,7 +2000,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
* If @a x targets a function pointer or a reference to a function
|
* If @a x targets a function pointer or a reference to a function
|
||||||
* object, then this operation will not throw an exception.
|
* object, then this operation will not throw an exception.
|
||||||
*/
|
*/
|
||||||
function& operator=(const function& __x)
|
function&
|
||||||
|
operator=(const function& __x)
|
||||||
{
|
{
|
||||||
function(__x).swap(*this);
|
function(__x).swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -1976,9 +2014,11 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
*
|
*
|
||||||
* The target of @a *this is deallocated, leaving it empty.
|
* The target of @a *this is deallocated, leaving it empty.
|
||||||
*/
|
*/
|
||||||
function& operator=(_M_clear_type*)
|
function&
|
||||||
|
operator=(_M_clear_type*)
|
||||||
|
{
|
||||||
|
if (_M_manager)
|
||||||
{
|
{
|
||||||
if (_M_manager) {
|
|
||||||
_M_manager(_M_functor, _M_functor, __destroy_functor);
|
_M_manager(_M_functor, _M_functor, __destroy_functor);
|
||||||
_M_manager = 0;
|
_M_manager = 0;
|
||||||
_M_invoker = 0;
|
_M_invoker = 0;
|
||||||
|
|
@ -2046,14 +2086,10 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
operator _Safe_bool() const
|
operator _Safe_bool() const
|
||||||
{
|
{
|
||||||
if (_M_empty())
|
if (_M_empty())
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return &_Hidden_type::_M_bool;
|
return &_Hidden_type::_M_bool;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// [3.7.2.4] function invocation
|
// [3.7.2.4] function invocation
|
||||||
|
|
||||||
|
|
@ -2107,10 +2143,12 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
function<_Res(_ArgTypes...)>::function(const function& __x)
|
function<_Res(_ArgTypes...)>::
|
||||||
|
function(const function& __x)
|
||||||
: _Function_base()
|
: _Function_base()
|
||||||
{
|
{
|
||||||
if (__x) {
|
if (__x)
|
||||||
|
{
|
||||||
_M_invoker = __x._M_invoker;
|
_M_invoker = __x._M_invoker;
|
||||||
_M_manager = __x._M_manager;
|
_M_manager = __x._M_manager;
|
||||||
__x._M_manager(_M_functor, __x._M_functor, __clone_functor);
|
__x._M_manager(_M_functor, __x._M_functor, __clone_functor);
|
||||||
|
|
@ -2119,14 +2157,16 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
template<typename _Functor>
|
template<typename _Functor>
|
||||||
function<_Res(_ArgTypes...)>
|
function<_Res(_ArgTypes...)>::
|
||||||
::function(_Functor __f,
|
function(_Functor __f,
|
||||||
typename __gnu_cxx::__enable_if<
|
typename __gnu_cxx::__enable_if<
|
||||||
!is_integral<_Functor>::value, _Useless>::__type)
|
!is_integral<_Functor>::value, _Useless>::__type)
|
||||||
: _Function_base()
|
: _Function_base()
|
||||||
{
|
{
|
||||||
typedef _Function_handler<_Signature_type, _Functor> _My_handler;
|
typedef _Function_handler<_Signature_type, _Functor> _My_handler;
|
||||||
if (_My_handler::_M_not_empty_function(__f)) {
|
|
||||||
|
if (_My_handler::_M_not_empty_function(__f))
|
||||||
|
{
|
||||||
_M_invoker = &_My_handler::_M_invoke;
|
_M_invoker = &_My_handler::_M_invoke;
|
||||||
_M_manager = &_My_handler::_M_manager;
|
_M_manager = &_My_handler::_M_manager;
|
||||||
_My_handler::_M_init_functor(_M_functor, __f);
|
_My_handler::_M_init_functor(_M_functor, __f);
|
||||||
|
|
@ -2134,7 +2174,9 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
_Res function<_Res(_ArgTypes...)>::operator()(_ArgTypes... __args) const
|
_Res
|
||||||
|
function<_Res(_ArgTypes...)>::
|
||||||
|
operator()(_ArgTypes... __args) const
|
||||||
{
|
{
|
||||||
if (_M_empty())
|
if (_M_empty())
|
||||||
{
|
{
|
||||||
|
|
@ -2148,7 +2190,9 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
const type_info& function<_Res(_ArgTypes...)>::target_type() const
|
const type_info&
|
||||||
|
function<_Res(_ArgTypes...)>::
|
||||||
|
target_type() const
|
||||||
{
|
{
|
||||||
if (_M_manager)
|
if (_M_manager)
|
||||||
{
|
{
|
||||||
|
|
@ -2157,14 +2201,14 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return *__typeinfo_result._M_access<const type_info*>();
|
return *__typeinfo_result._M_access<const type_info*>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return typeid(void);
|
return typeid(void);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
template<typename _Functor>
|
template<typename _Functor>
|
||||||
_Functor* function<_Res(_ArgTypes...)>::target()
|
_Functor*
|
||||||
|
function<_Res(_ArgTypes...)>::
|
||||||
|
target()
|
||||||
{
|
{
|
||||||
if (typeid(_Functor) == target_type() && _M_manager)
|
if (typeid(_Functor) == target_type() && _M_manager)
|
||||||
{
|
{
|
||||||
|
|
@ -2176,14 +2220,14 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return __ptr._M_access<_Functor*>();
|
return __ptr._M_access<_Functor*>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
template<typename _Functor>
|
template<typename _Functor>
|
||||||
const _Functor* function<_Res(_ArgTypes...)>::target() const
|
const _Functor*
|
||||||
|
function<_Res(_ArgTypes...)>::
|
||||||
|
target() const
|
||||||
{
|
{
|
||||||
if (typeid(_Functor) == target_type() && _M_manager)
|
if (typeid(_Functor) == target_type() && _M_manager)
|
||||||
{
|
{
|
||||||
|
|
@ -2192,10 +2236,8 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
|
||||||
return __ptr._M_access<const _Functor*>();
|
return __ptr._M_access<const _Functor*>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// [3.7.2.7] null pointer comparisons
|
// [3.7.2.7] null pointer comparisons
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue