diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-08-11 21:04:31 +0400 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-08-11 21:04:31 +0400 |
commit | 54b409fdb9489b305bf95f4d4f52b49c7926c429 (patch) | |
tree | 4e1c893fe8a940ea767c4eef990dff879fcbbd25 /libcxx/include/functional | |
parent | 37aab7674a74dd0224b14976e91f89abe48e9ae9 (diff) |
now works with -fno-exceptions and -fno-rtti
llvm-svn: 110828
Diffstat (limited to 'libcxx/include/functional')
-rw-r--r-- | libcxx/include/functional | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libcxx/include/functional b/libcxx/include/functional index e645a55e7afd..430f32553896 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -1000,8 +1000,10 @@ public: virtual void destroy() = 0; virtual void destroy_deallocate() = 0; virtual _R operator()(_ArgTypes&& ...) = 0; +#ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const = 0; virtual const std::type_info& target_type() const = 0; +#endif }; template<class _FD, class _Alloc, class _FB> class __func; @@ -1019,8 +1021,10 @@ public: virtual void destroy(); virtual void destroy_deallocate(); virtual _R operator()(_ArgTypes&& ... __arg); +#ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const; virtual const std::type_info& target_type() const; +#endif }; template<class _F, class _Alloc, class _R, class ..._ArgTypes> @@ -1066,6 +1070,8 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) return __invoke(__f_.first(), _STD::forward<_ArgTypes>(__arg)...); } +#ifndef _LIBCPP_NO_RTTI + template<class _F, class _Alloc, class _R, class ..._ArgTypes> const void* __func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const @@ -1082,6 +1088,8 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const return typeid(_F); } +#endif + } // __function template<class _R, class ..._ArgTypes> @@ -1163,10 +1171,12 @@ public: // 20.7.16.2.4, function invocation: _R operator()(_ArgTypes...) const; +#ifndef _LIBCPP_NO_RTTI // 20.7.16.2.5, function target access: const std::type_info& target_type() const; template <typename _T> _T* target(); template <typename _T> const _T* target() const; +#endif }; template<class _R, class ..._ArgTypes> @@ -1331,11 +1341,15 @@ template<class _R, class ..._ArgTypes> _R function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const { +#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) throw bad_function_call(); +#endif return (*__f_)(_STD::forward<_ArgTypes>(__arg)...); } +#ifndef _LIBCPP_NO_RTTI + template<class _R, class ..._ArgTypes> const std::type_info& function<_R(_ArgTypes...)>::target_type() const @@ -1365,6 +1379,8 @@ function<_R(_ArgTypes...)>::target() const return (const _T*)__f_->target(typeid(_T)); } +#endif + template <class _R, class... _ArgTypes> inline _LIBCPP_INLINE_VISIBILITY bool |