summaryrefslogtreecommitdiff
path: root/rep/usr/include/c++/4.3/backward/binders.h.gcov.html
blob: 861e1d965e10c2c7988157c9b542cb11698b1b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - lcov.info - /usr/include/c++/4.3/backward/binders.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../../../../index.html">directory</a> - <a href="index.html">usr/include/c++/4.3/backward</a> - binders.h</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>lcov.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2008-08-14</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">7</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">7</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : // Functor implementations -*- C++ -*-
<span class="lineNum">       2 </span>                : 
<span class="lineNum">       3 </span>                : // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
<span class="lineNum">       4 </span>                : // Free Software Foundation, Inc.
<span class="lineNum">       5 </span>                : //
<span class="lineNum">       6 </span>                : // This file is part of the GNU ISO C++ Library.  This library is free
<span class="lineNum">       7 </span>                : // software; you can redistribute it and/or modify it under the
<span class="lineNum">       8 </span>                : // terms of the GNU General Public License as published by the
<span class="lineNum">       9 </span>                : // Free Software Foundation; either version 2, or (at your option)
<span class="lineNum">      10 </span>                : // any later version.
<span class="lineNum">      11 </span>                : 
<span class="lineNum">      12 </span>                : // This library is distributed in the hope that it will be useful,
<span class="lineNum">      13 </span>                : // but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum">      14 </span>                : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class="lineNum">      15 </span>                : // GNU General Public License for more details.
<span class="lineNum">      16 </span>                : 
<span class="lineNum">      17 </span>                : // You should have received a copy of the GNU General Public License along
<span class="lineNum">      18 </span>                : // with this library; see the file COPYING.  If not, write to the Free
<span class="lineNum">      19 </span>                : // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
<span class="lineNum">      20 </span>                : // USA.
<span class="lineNum">      21 </span>                : 
<span class="lineNum">      22 </span>                : // As a special exception, you may use this file as part of a free software
<span class="lineNum">      23 </span>                : // library without restriction.  Specifically, if other files instantiate
<span class="lineNum">      24 </span>                : // templates or use macros or inline functions from this file, or you compile
<span class="lineNum">      25 </span>                : // this file and link it with other files to produce an executable, this
<span class="lineNum">      26 </span>                : // file does not by itself cause the resulting executable to be covered by
<span class="lineNum">      27 </span>                : // the GNU General Public License.  This exception does not however
<span class="lineNum">      28 </span>                : // invalidate any other reasons why the executable file might be covered by
<span class="lineNum">      29 </span>                : // the GNU General Public License.
<span class="lineNum">      30 </span>                : 
<span class="lineNum">      31 </span>                : /*
<span class="lineNum">      32 </span>                :  *
<span class="lineNum">      33 </span>                :  * Copyright (c) 1994
<span class="lineNum">      34 </span>                :  * Hewlett-Packard Company
<span class="lineNum">      35 </span>                :  *
<span class="lineNum">      36 </span>                :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      37 </span>                :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      38 </span>                :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      39 </span>                :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      40 </span>                :  * in supporting documentation.  Hewlett-Packard Company makes no
<span class="lineNum">      41 </span>                :  * representations about the suitability of this software for any
<span class="lineNum">      42 </span>                :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      43 </span>                :  *
<span class="lineNum">      44 </span>                :  *
<span class="lineNum">      45 </span>                :  * Copyright (c) 1996-1998
<span class="lineNum">      46 </span>                :  * Silicon Graphics Computer Systems, Inc.
<span class="lineNum">      47 </span>                :  *
<span class="lineNum">      48 </span>                :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      49 </span>                :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      50 </span>                :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      51 </span>                :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      52 </span>                :  * in supporting documentation.  Silicon Graphics makes no
<span class="lineNum">      53 </span>                :  * representations about the suitability of this software for any
<span class="lineNum">      54 </span>                :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      55 </span>                :  */
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span>                : /** @file backward/binders.h
<span class="lineNum">      58 </span>                :  *  This is an internal header file, included by other library headers.
<span class="lineNum">      59 </span>                :  *  You should not attempt to use it directly.
<span class="lineNum">      60 </span>                :  */
<span class="lineNum">      61 </span>                : 
<span class="lineNum">      62 </span>                : #ifndef _GLIBCXX_BINDERS_H
<span class="lineNum">      63 </span>                : #define _GLIBCXX_BINDERS_H 1
<span class="lineNum">      64 </span>                : 
<span class="lineNum">      65 </span>                : _GLIBCXX_BEGIN_NAMESPACE(std)
<span class="lineNum">      66 </span>                : 
<span class="lineNum">      67 </span>                :   // 20.3.6 binders
<span class="lineNum">      68 </span>                :   /** @defgroup s20_3_6_binder Binder Classes
<span class="lineNum">      69 </span>                :    *  Binders turn functions/functors with two arguments into functors with
<span class="lineNum">      70 </span>                :    *  a single argument, storing an argument to be applied later.  For
<span class="lineNum">      71 </span>                :    *  example, a variable @c B of type @c binder1st is constructed from a
<span class="lineNum">      72 </span>                :    *  functor @c f and an argument @c x.  Later, B's @c operator() is called
<span class="lineNum">      73 </span>                :    *  with a single argument @c y.  The return value is the value of @c f(x,y).
<span class="lineNum">      74 </span>                :    *  @c B can be &quot;called&quot; with various arguments (y1, y2, ...) and will in
<span class="lineNum">      75 </span>                :    *  turn call @c f(x,y1), @c f(x,y2), ...
<span class="lineNum">      76 </span>                :    *
<span class="lineNum">      77 </span>                :    *  The function @c bind1st is provided to save some typing.  It takes the
<span class="lineNum">      78 </span>                :    *  function and an argument as parameters, and returns an instance of
<span class="lineNum">      79 </span>                :    *  @c binder1st.
<span class="lineNum">      80 </span>                :    *
<span class="lineNum">      81 </span>                :    *  The type @c binder2nd and its creator function @c bind2nd do the same
<span class="lineNum">      82 </span>                :    *  thing, but the stored argument is passed as the second parameter instead
<span class="lineNum">      83 </span>                :    *  of the first, e.g., @c bind2nd(std::minus&lt;float&gt;,1.3) will create a
<span class="lineNum">      84 </span>                :    *  functor whose @c operator() accepts a floating-point number, subtracts
<span class="lineNum">      85 </span>                :    *  1.3 from it, and returns the result.  (If @c bind1st had been used,
<span class="lineNum">      86 </span>                :    *  the functor would perform &quot;1.3 - x&quot; instead.
<span class="lineNum">      87 </span>                :    *
<span class="lineNum">      88 </span>                :    *  Creator-wrapper functions like @c bind1st are intended to be used in
<span class="lineNum">      89 </span>                :    *  calling algorithms.  Their return values will be temporary objects.
<span class="lineNum">      90 </span>                :    *  (The goal is to not require you to type names like
<span class="lineNum">      91 </span>                :    *  @c std::binder1st&lt;std::plus&lt;int&gt;&gt; for declaring a variable to hold the
<span class="lineNum">      92 </span>                :    *  return value from @c bind1st(std::plus&lt;int&gt;,5).
<span class="lineNum">      93 </span>                :    *
<span class="lineNum">      94 </span>                :    *  These become more useful when combined with the composition functions.
<span class="lineNum">      95 </span>                :    *
<span class="lineNum">      96 </span>                :    *  @{
<span class="lineNum">      97 </span>                :    */
<span class="lineNum">      98 </span>                :   /// One of the @link s20_3_6_binder binder functors@endlink.
<span class="lineNum">      99 </span>                :   template&lt;typename _Operation&gt;
<span class="lineNum">     100 </span>                :     class binder1st
<span class="lineNum">     101 </span>                :     : public unary_function&lt;typename _Operation::second_argument_type,
<span class="lineNum">     102 </span>                :                             typename _Operation::result_type&gt;
<span class="lineNum">     103 </span><span class="lineCov">             16 :     {</span>
<span class="lineNum">     104 </span>                :     protected:
<span class="lineNum">     105 </span>                :       _Operation op;
<span class="lineNum">     106 </span>                :       typename _Operation::first_argument_type value;
<span class="lineNum">     107 </span>                : 
<span class="lineNum">     108 </span>                :     public:
<span class="lineNum">     109 </span>                :       binder1st(const _Operation&amp; __x,
<span class="lineNum">     110 </span><span class="lineCov">             19 :                 const typename _Operation::first_argument_type&amp; __y)</span>
<span class="lineNum">     111 </span><span class="lineCov">             19 :       : op(__x), value(__y) { }</span>
<span class="lineNum">     112 </span>                : 
<span class="lineNum">     113 </span>                :       typename _Operation::result_type
<span class="lineNum">     114 </span><span class="lineCov">             70 :       operator()(const typename _Operation::second_argument_type&amp; __x) const</span>
<span class="lineNum">     115 </span><span class="lineCov">             70 :       { return op(value, __x); }</span>
<span class="lineNum">     116 </span>                : 
<span class="lineNum">     117 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     118 </span>                :       // 109.  Missing binders for non-const sequence elements
<span class="lineNum">     119 </span>                :       typename _Operation::result_type
<span class="lineNum">     120 </span>                :       operator()(typename _Operation::second_argument_type&amp; __x) const
<span class="lineNum">     121 </span>                :       { return op(value, __x); }
<span class="lineNum">     122 </span>                :     } _GLIBCXX_DEPRECATED_ATTR;
<span class="lineNum">     123 </span>                : 
<span class="lineNum">     124 </span>                :   /// One of the @link s20_3_6_binder binder functors@endlink.
<span class="lineNum">     125 </span>                :   template&lt;typename _Operation, typename _Tp&gt;
<span class="lineNum">     126 </span>                :     inline binder1st&lt;_Operation&gt;
<span class="lineNum">     127 </span><span class="lineCov">             19 :     bind1st(const _Operation&amp; __fn, const _Tp&amp; __x)</span>
<span class="lineNum">     128 </span>                :     {
<span class="lineNum">     129 </span>                :       typedef typename _Operation::first_argument_type _Arg1_type;
<span class="lineNum">     130 </span><span class="lineCov">             19 :       return binder1st&lt;_Operation&gt;(__fn, _Arg1_type(__x));</span>
<span class="lineNum">     131 </span>                :     }
<span class="lineNum">     132 </span>                : 
<span class="lineNum">     133 </span>                :   /// One of the @link s20_3_6_binder binder functors@endlink.
<span class="lineNum">     134 </span>                :   template&lt;typename _Operation&gt;
<span class="lineNum">     135 </span>                :     class binder2nd
<span class="lineNum">     136 </span>                :     : public unary_function&lt;typename _Operation::first_argument_type,
<span class="lineNum">     137 </span>                :                             typename _Operation::result_type&gt;
<span class="lineNum">     138 </span>                :     {
<span class="lineNum">     139 </span>                :     protected:
<span class="lineNum">     140 </span>                :       _Operation op;
<span class="lineNum">     141 </span>                :       typename _Operation::second_argument_type value;
<span class="lineNum">     142 </span>                : 
<span class="lineNum">     143 </span>                :     public:
<span class="lineNum">     144 </span>                :       binder2nd(const _Operation&amp; __x,
<span class="lineNum">     145 </span>                :                 const typename _Operation::second_argument_type&amp; __y)
<span class="lineNum">     146 </span>                :       : op(__x), value(__y) { }
<span class="lineNum">     147 </span>                : 
<span class="lineNum">     148 </span>                :       typename _Operation::result_type
<span class="lineNum">     149 </span>                :       operator()(const typename _Operation::first_argument_type&amp; __x) const
<span class="lineNum">     150 </span>                :       { return op(__x, value); }
<span class="lineNum">     151 </span>                : 
<span class="lineNum">     152 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     153 </span>                :       // 109.  Missing binders for non-const sequence elements
<span class="lineNum">     154 </span>                :       typename _Operation::result_type
<span class="lineNum">     155 </span>                :       operator()(typename _Operation::first_argument_type&amp; __x) const
<span class="lineNum">     156 </span>                :       { return op(__x, value); }
<span class="lineNum">     157 </span>                :     } _GLIBCXX_DEPRECATED_ATTR;
<span class="lineNum">     158 </span>                : 
<span class="lineNum">     159 </span>                :   /// One of the @link s20_3_6_binder binder functors@endlink.
<span class="lineNum">     160 </span>                :   template&lt;typename _Operation, typename _Tp&gt;
<span class="lineNum">     161 </span>                :     inline binder2nd&lt;_Operation&gt;
<span class="lineNum">     162 </span>                :     bind2nd(const _Operation&amp; __fn, const _Tp&amp; __x)
<span class="lineNum">     163 </span>                :     {
<span class="lineNum">     164 </span>                :       typedef typename _Operation::second_argument_type _Arg2_type;
<span class="lineNum">     165 </span>                :       return binder2nd&lt;_Operation&gt;(__fn, _Arg2_type(__x));
<span class="lineNum">     166 </span>                :     } 
<span class="lineNum">     167 </span>                :   /** @}  */
<span class="lineNum">     168 </span>                : 
<span class="lineNum">     169 </span>                : _GLIBCXX_END_NAMESPACE
<span class="lineNum">     170 </span>                : 
<span class="lineNum">     171 </span>                : #endif /* _GLIBCXX_BINDERS_H */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>