1c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//===----------------------------------------------------------------------===//
2c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
3c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//                     The LLVM Compiler Infrastructure
4c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
8c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//===----------------------------------------------------------------------===//
9c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
10c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// <functional>
11c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
12c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template<Returnable R, CopyConstructible... ArgTypes>
13c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// class function<R(ArgTypes...)>
14c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//   : public unary_function<T1, R>      // iff sizeof...(ArgTypes) == 1 and
15c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//                                       // ArgTypes contains T1
16c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//   : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
17c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//                                       // ArgTypes contains T1 and T2
18c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// {
19c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// public:
20c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//     typedef R result_type;
21c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//     ...
22c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// };
23c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
24c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include <functional>
25c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include <type_traits>
26c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
27c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnantint main()
28c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant{
29c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert((!std::is_base_of<std::unary_function <int, int>,
30c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<int()> >::value), "");
31c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
32c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<int()> >::value), "");
33c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert(( std::is_same<          std::function<int()>::result_type,
34c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                                         int>::value), "");
35c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
36c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert(( std::is_base_of<std::unary_function <int, double>,
37c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<double(int)> >::value), "");
38c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert((!std::is_base_of<std::binary_function<int, int, double>,
39c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<double(int)> >::value), "");
40c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert(( std::is_same<          std::function<double(int)>::result_type,
41c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                                         double>::value), "");
42c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
43c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert((!std::is_base_of<std::unary_function <int, double>,
44c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<double(int, char)> >::value), "");
45c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert(( std::is_base_of<std::binary_function<int, char, double>,
46c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                           std::function<double(int, char)> >::value), "");
47c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    static_assert(( std::is_same<          std::function<double(int, char)>::result_type,
48c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant                                                         double>::value), "");
49c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant}
50