From Jason Turner

[depr.lib.binders]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpupje6psz/{from.md → to.md} +0 -84
tmp/tmpupje6psz/{from.md → to.md} RENAMED
@@ -1,84 +0,0 @@
1
- ## Binders <a id="depr.lib.binders">[[depr.lib.binders]]</a>
2
-
3
- The binders `binder1st`, `bind1st`, `binder2nd`, and `bind2nd` are
4
- deprecated. The function template `bind` ([[func.bind.bind]]) provides
5
- a better solution.
6
-
7
- ### Class template `binder1st` <a id="depr.lib.binder.1st">[[depr.lib.binder.1st]]</a>
8
-
9
- ``` cpp
10
- template <class Fn>
11
- class binder1st
12
- : public unary_function<typename Fn::second_argument_type,
13
- typename Fn::result_type> {
14
- protected:
15
- Fn op;
16
- typename Fn::first_argument_type value;
17
- public:
18
- binder1st(const Fn& x,
19
- const typename Fn::first_argument_type& y);
20
- typename Fn::result_type
21
- operator()(const typename Fn::second_argument_type& x) const;
22
- typename Fn::result_type
23
- operator()(typename Fn::second_argument_type& x) const;
24
- };
25
- ```
26
-
27
- The constructor initializes `op` with `x` and `value` with `y`.
28
-
29
- `operator()` returns `op``(value,x)`.
30
-
31
- ### `bind1st` <a id="depr.lib.bind.1st">[[depr.lib.bind.1st]]</a>
32
-
33
- ``` cpp
34
- template <class Fn, class T>
35
- binder1st<Fn> bind1st(const Fn& fn, const T& x);
36
- ```
37
-
38
- *Returns:* `binder1st<Fn>(fn, typename Fn::first_argument_type(x))`.
39
-
40
- ### Class template `binder2nd` <a id="depr.lib.binder.2nd">[[depr.lib.binder.2nd]]</a>
41
-
42
- ``` cpp
43
- template <class Fn>
44
- class binder2nd
45
- : public unary_function<typename Fn::first_argument_type,
46
- typename Fn::result_type> {
47
- protected:
48
- Fn op;
49
- typename Fn::second_argument_type value;
50
- public:
51
- binder2nd(const Fn& x,
52
- const typename Fn::second_argument_type& y);
53
- typename Fn::result_type
54
- operator()(const typename Fn::first_argument_type& x) const;
55
- typename Fn::result_type
56
- operator()(typename Fn::first_argument_type& x) const;
57
- };
58
- ```
59
-
60
- The constructor initializes `op` with `x` and `value` with `y`.
61
-
62
- `operator()` returns `op``(x,value)`.
63
-
64
- ### `bind2nd` <a id="depr.lib.bind.2nd">[[depr.lib.bind.2nd]]</a>
65
-
66
- ``` cpp
67
- template <class Fn, class T>
68
- binder2nd<Fn> bind2nd(const Fn& op, const T& x);
69
- ```
70
-
71
- *Returns:* `binder2nd<Fn>(op, typename Fn::second_argument_type(x))`.
72
-
73
- ``` cpp
74
- find_if(v.begin(), v.end(), bind2nd(greater<int>(), 5));
75
- ```
76
-
77
- finds the first integer in vector `v` greater than 5;
78
-
79
- ``` cpp
80
- find_if(v.begin(), v.end(), bind1st(greater<int>(), 5));
81
- ```
82
-
83
- finds the first integer in `v` less than 5.
84
-