1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // template <class Fn>
13 // : public unary_function<typename Fn::first_argument_type, typename Fn::result_type>
17 // typename Fn::second_argument_type value;
19 // binder2nd(const Fn& x, const typename Fn::second_argument_type& y);
21 // typename Fn::result_type operator()(const typename Fn::first_argument_type& x) const;
22 // typename Fn::result_type operator()(typename Fn::first_argument_type& x) const;
25 // REQUIRES: c++03 || c++11 || c++14
26 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
29 #include <type_traits>
32 #include "test_macros.h"
33 #include "../test_func.h"
36 : public std::binder2nd
<test_func
>
38 typedef std::binder2nd
<test_func
> base
;
40 test() : std::binder2nd
<test_func
>(test_func(3), 4.5) {}
44 static_assert((std::is_base_of
<
45 std::unary_function
<test_func::first_argument_type
,
46 test_func::result_type
>,
52 assert((*this)(i
) == 22.5);
53 assert((*this)(5) == 0.5);