diff --git a/include/type_traits b/include/type_traits index 35777c8e..653809cb 100644 --- a/include/type_traits +++ b/include/type_traits @@ -1321,6 +1321,71 @@ public: typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type; }; +#if 0 + +template +struct __result_of_mp; + +// member function pointer + +template +struct __result_of_mp<_R (_Class::*)(_Params...), _Tp, _Args...> +{ + typedef _R type; +}; + +template +struct __result_of_mp<_R (_Class::*)(_Params...) const, _Tp, _Args...> +{ + typedef _R type; +}; + +template +struct __result_of_mp<_R (_Class::*)(_Params...) volatile, _Tp, _Args...> +{ + typedef _R type; +}; + +template +struct __result_of_mp<_R (_Class::*)(_Params...) const volatile, _Tp, _Args...> +{ + typedef _R type; +}; + +// member data pointer + +template +struct __result_of_mdp; + +template +struct __result_of_mdp<_R _Class::*, _Tp, false> +{ + typedef typename __apply_cv()), _R>::type type; +}; + +template +struct __result_of_mdp<_R _Class::*, _Tp, true> +{ + typedef typename __apply_cv<_Tp, _R>::type&& type; +}; + +template +struct __result_of_mp<_R _Class::*, _Tp> + : public __result_of_mdp<_R _Class::*, _Tp, + is_base_of<_Class, typename remove_reference<_Tp>::type>::value> +{ +}; + +template +class __result_of<_Fn(_Tp, _ArgTypes...), false> // _Fn must be member pointer + : public __result_of_mp<_Fn, _Tp, _ArgTypes...> +{ +}; + +#endif + +// result_of + template class result_of<_Fn(_ArgTypes...)> : public __result_of<_Fn(_ArgTypes...), diff --git a/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp index 3795f8e3..b1468de6 100644 --- a/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp +++ b/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // result_of #include typedef bool (&PF1)(); typedef short (*PF2)(long); struct S { operator PF2() const; double operator()(char, int&); }; int main() { static_assert((std::is_same::type, short>::value), "Error!"); static_assert((std::is_same::type, double>::value), "Error!"); static_assert((std::is_same::type, bool>::value), "Error!"); } \ No newline at end of file +//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // result_of #include #include typedef bool (&PF1)(); typedef short (*PF2)(long); struct S { operator PF2() const; double operator()(char, int&); void calc(long) const; char data_; }; typedef void (S::*PMS)(long) const; typedef char S::*PMD; int main() { static_assert((std::is_same::type, short>::value), "Error!"); static_assert((std::is_same::type, double>::value), "Error!"); static_assert((std::is_same::type, bool>::value), "Error!"); // static_assert(std::is_same, int)>::type, void>::value, "Error!"); // static_assert(std::is_same::type, char&&>::value, "Error!"); // static_assert(std::is_same::type, const char&>::value, "Error!"); } \ No newline at end of file diff --git a/www/libcxx_by_chapter.pdf b/www/libcxx_by_chapter.pdf index 8a03784f..b460d2e8 100644 Binary files a/www/libcxx_by_chapter.pdf and b/www/libcxx_by_chapter.pdf differ