//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// has weak result type
#include<functional>#include<type_traits>classfunctor1:publicstd::unary_function<int,char>{};classfunctor2:publicstd::binary_function<char,int,double>{};classfunctor3:publicstd::unary_function<char,int>,publicstd::binary_function<char,int,double>{public:typedeffloatresult_type;};classfunctor4:publicstd::unary_function<char,int>,publicstd::binary_function<char,int,double>{public:};classC{};template<classT>structhas_result_type{private:structtwo{char_;char__;};template<classU>statictwotest(...);template<classU>staticchartest(typenameU::result_type*=0);public:staticconstboolvalue=sizeof(test<T>(0))==1;};intmain(){static_assert((std::is_same<std::reference_wrapper<functor1>::result_type,char>::value),"");static_assert((std::is_same<std::reference_wrapper<functor2>::result_type,double>::value),"");static_assert((std::is_same<std::reference_wrapper<functor3>::result_type,float>::value),"");static_assert((std::is_same<std::reference_wrapper<void()>::result_type,void>::value),"");static_assert((std::is_same<std::reference_wrapper<int*(double*)>::result_type,int*>::value),"");static_assert((std::is_same<std::reference_wrapper<void(*)()>::result_type,void>::value),"");static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::result_type,int*>::value),"");static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::result_type,int*>::value),"");static_assert((std::is_same<std::reference_wrapper<int(C::*)(double*)constvolatile>::result_type,int>::value),"");static_assert((std::is_same<std::reference_wrapper<C()>::result_type,C>::value),"");static_assert(has_result_type<std::reference_wrapper<functor3>>::value,"");static_assert(!has_result_type<std::reference_wrapper<functor4>>::value,"");static_assert(!has_result_type<std::reference_wrapper<C>>::value,"");}