/usr/share/doc/libbobcat2-dev/man/fnwrap.3.html is in libbobcat-dev 2.20.01-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <html><head>
<title>FBB::FnWrap</title>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::FnWrap</h1>
<h2>libbobcat1-dev_2.20.01-x.tar.gz</h2>
<h2>2005-2011</h2>
<html><head>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1></h1>
<html><head>
<title>FBB::FnWrap(3bobcat)</title>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::FnWrap(3bobcat)</h1>
<h2>libbobcat1-dev_2.20.01-x.tar.gz Configurable Function Wrapper</h2>
<h2>2005-2011</h2>
<p>
<h2>NAME</h2>FnWrap - Generic configurable context function wrapper class
<p>
<h2>SYNOPSIS</h2>
<strong>#include <bobcat/fnwrap></strong><br>
<p>
<h2>DESCRIPTION</h2>
The <strong>FBB::FnWrap</strong> class traditionally contains two static members:
<em>unary</em> and <em>binary</em>. These functions are still available, but since
Bobcat version 2.15.00 they have identical implementations and are in fact
superseded by the new free function <em>FBB::context</em> (see below). All three
functions return the appropriate (unary or binary) functor that is ordinarily
called from generic algorithms of the standard template library, expecting a
unary or binary functor or predicate.
<p>
In this description there's no further reference to
<em>FnWrap::unary</em> and <em>FnWrap::binary</em>. Instead, <em>FBB::context</em> is
referred to, usually as just <em>context</em>. Instead of <em>context</em> the functions
<em>FnWrap::unary</em> or <em>FnWrap::binary</em> could be used as
well. <em>FnWrap::unary</em> and <em>FnWrap::binary</em> will continue to be available
in future versions of Bobcat.
<p>
The <em>context</em> function expects the name of a (static or free)
function that is called by the functor's function operator. The
arguments received by the functor's function operator are forwarded to this
static or free function.
<p>
Any additional arguments that are passed to <em>context</em> are forwarded to the
function called by the functor's function operator. This allows users of
<em>FnWrap</em> to pass a <em>local context</em> to the function that is indirectly
called by a generic algorithm.
<p>
The number and types of arguments are determined by the parameter list of the
function specified as first argument of <em>context</em>. If that function, in
addition to parameters matching the types of the arguments provided by the
generic algorithm also defines, e.g., an <em>int</em> and a <em>std::string &</em>
parameter, then <em>context</em> must be called with arguments being, respectively,
the address of the function to call, an <em>int</em> argument and a <em>std::string</em>
<em>lvalue</em>.
<p>
The type of the return value of the function that is passed to <em>context</em>
also becomes the return type of the functor's function call operator. So if
the generic algorithm expects a predicate function the function called by the
functor's function call operator should return a <em>bool</em> value.
<p>
The called function must be a static member or free function. Using a static
member or free function has several advantages over calling a non-static
class member function:
<ul>
<li> No object for which the member function will be called is required;
<li> There is no introduced uncertainty about the <strong>const</strong>-ness of the
callled function, as static member functions and free functions do not support
<strong>const</strong> modifiers;
<li> The called function can be a static member function of the class
using the generic algorithm to which the <strong>FnWrap</strong> object is passed. By
specifying the calling object as one of the arguments of <em>context</em>, the
called function will receive this object as well and may directly access the
calling object's members;
<li> The passed function can be a static member function of the class
whose objects are passed to the function via the generic template function's
iterator parameters. In that case the function may directly access the passed
object's members.
<li> Since no object is involved in calling the static function, no
ambiguity can arise as to whether an object reference or an object pointer
should be used in calling the function: static (member) functions may be
called without using objects.
</ul>
<p>
<h2>NAMESPACE</h2>
<strong>FBB</strong><br>
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong>FBB</strong>.
<p>
<h2>INHERITS FROM</h2>
-
<p>
<h2>FREE FUNCTION</h2>
<ul>
<li> <strong>Functor context(Function [, Arguments])</strong>:<br>
This function is defined in the namespace <em>FBB</em>. <br>
<em>Functor</em> represents the (unary or binary) functor that can be used
by generic algorithms;<br>
<em>Function</em> is the name of a static member or free function that is
called from the <em>Functor</em>'s function operator. The type of its first
argument (or first two arguments if a binary functor is used) must match the
type(s) of the argument(s) received by the functor's function call
operator. Any additional parameters it may define must match, in types and
number, the additional arguments that are passed to
<em>context</em>. <em>Function</em>'s return type becomes the return type of
<em>Functor</em>'s function call operator. If a value is returned by <em>Function</em>
that value will be returned by <em>Functor</em>'s function call operator.
</ul>
<p>
<h2>STATIC MEMBERS</h2>
<ul>
<li> <strong>Functor unary(Function [, Arguments])</strong>:<br>
See <em>FBB::context</em>'s description.
<p>
<li> <strong>Functor binary(Function [, Arguments])</strong>:<br>
See <em>FBB::context</em>'s description.
</ul>
<p>
<h2>TYPEDEFS</h2>
<p>
The functors defines types, that may be required by generic algorithms:
<ul>
<li> <strong>first_argument_type</strong>:<br>, a synonym for the basic type of the argument
received by the unary functor's function call operator and of the first
argument received by the binary functor's function call operator. E.g., if
the actual type is <em>std::string const *</em> then <em>argument_type</em> will
be <em>std::string</em>;
<li> <strong>second_argument_type</strong>:<br>, a synonym for the basic type of the second
argument received by the binary functor's function call operator.
<li> <strong>result_type</strong>:<br>, a synonym for the basic type of the return type of the
functor's function call operator.
</ul>
<p>
<h2>EXAMPLES</h2>
<pre>
// accumulating strings from a vector to one big string, using
// `accumulate'
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <bobcat/fnwrap>
using namespace std;
using namespace FBB;
class Strings
{
vector<string> d_vs;
public:
Strings()
:
d_vs({"one", "two", "three"})
{}
void display(ostream &out) const
{
size_t count = 0;
cout << "On Exit: " <<
accumulate(
d_vs.begin(), d_vs.end(),
string("HI"),
context(show, count, out)) << '\n';
}
private:
static string show(string const &str1,
string const &str2,
size_t &nr, ostream &out)
{
out << ++nr << " " << str1 << " " << str2 << '\n';
return str1 + " " + str2;
}
};
int main()
{
Strings s;
s.display(cout);
}
</pre>
After compilation and linking, simply call the program without any
arguments.
<p>
<h2>FILES</h2>
<em>bobcat/fnwrap</em> - defines the class interface
<p>
<h2>SEE ALSO</h2>
<strong>bobcat</strong>(7), <strong>foreach</strong>(3bobcat), <strong>repeat</strong>(3bobcat)
<p>
<h2>BUGS</h2>
None Reported.
<p>
<h2>DISTRIBUTION FILES</h2>
<ul>
<li> <em>bobcat_2.20.01-x.dsc</em>: detached signature;
<li> <em>bobcat_2.20.01-x.tar.gz</em>: source archive;
<li> <em>bobcat_2.20.01-x_i386.changes</em>: change log;
<li> <em>libbobcat1_2.20.01-x_*.deb</em>: debian package holding the
libraries;
<li> <em>libbobcat1-dev_2.20.01-x_*.deb</em>: debian package holding the
libraries, headers and manual pages;
<li> <em>http://sourceforge.net/projects/bobcat</em>: public archive location;
</ul>
<p>
<h2>BOBCAT</h2>
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2>COPYRIGHT</h2>
This is free software, distributed under the terms of the
GNU General Public License (GPL).
<p>
<h2>AUTHOR</h2>
Frank B. Brokken (<strong>f.b.brokken@rug.nl</strong>).
<p>
|