/usr/share/doc/libbobcat4-dev/man/linearmap.3.html is in libbobcat-dev 4.08.02-2build1.
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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::LinearMap(3bobcat)</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
.XXfc {margin-left:auto;margin-right:auto;}
.XXtc {text-align: center;}
.XXtl {text-align: left;}
.XXtr {text-align: right;}
.XXvt {vertical-align: top;}
.XXvb {vertical-align: bottom;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::LinearMap(3bobcat)</h1>
<h2 id="author">Linear-search based mapping container<br/>(libbobcat-dev_4.08.02-x.tar.gz)</h2>
<h2 id="date">2005-2017</h2>
<p>
<h2 >NAME</h2>FBB::LinearMap - A mapping container using linear searching
<p>
<h2 >SYNOPSIS</h2>
<strong >#include <bobcat/linearmap></strong><br/>
<p>
<h2 >DESCRIPTION</h2>
The class template <strong >LinearMap</strong> implements a mapping container using a
linear searching algorithm. A mapping container using linear searching is less
complex than either the sorted <em >std::map</em> or the unsorted
<em >std::unordered_map</em> container. For relative small number of elements the
linear search algorithm is also faster than the binary search or hashing-based
searching algorithms.
<p>
<strong >LinearMap</strong> implements all of the members which are also found in the
standard <em >std::map</em>, except for the <em >key_comp</em> and <em >value_comp</em>
members. These latter two members are not available as ordering the keys is
not an issue with the unordered, linear searching method which is used by
<strong >LinearMap</strong>.
<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 (PRIVATELY) FROM</h2>
<em >std::vector<Key, Value, Allocator></em>
<p>
<h2 >TEMPLATE TYPES</h2>
The full template type definition of <strong >LinearMap</strong> is:
<pre>
template <
typename Key, typename Value,
typename Alloc = std::allocator< std::pair<Key const, Value> >
>
</pre>
The <em >Key</em> type must offer <em >bool operator==</em>. Furthermore, <em >Key</em> and
<em >Value</em> types must support default and copy constructors and overloaded
(copy) assignment operators.
<p>
<h2 >TYPEDEFS</h2>
<ul>
<li> <em >typedef std::pair<Key, Value> value_type</em>;
<li> <em >iterator</em> - an iterator to a <strong >LinearMap</strong> object's elements;
<li> <em >const_iterator</em> - a <em >const_iterator</em> to a <strong >LinearMap</strong> object's
elements;
<li> <em >reverse_iterator</em> - a <em >reverse_iterator</em> to a <strong >LinearMap</strong> object's
elements;
<li> <em >const_reverse_iterator</em> - a <em >const_reverse_iterator</em> to a
<strong >LinearMap</strong> object's elements.
</ul>
<p>
<h2 >CONSTRUCTORS</h2>
<ul>
<li> <strong >LinearMap(Iterator begin, Iterator end)</strong>:<br/>
The constructor is initialized using the iterator range <em >[begin,
end)</em>, where <em >Iterator</em> is any iterator type pointing to <em >value_type</em>
objects. If identical keys <em >K</em> are used then only the first occurrence
of the <em >value_type</em> object using key <em >K</em> is inserted.
<p>
<li> <strong >LinearMap(std:initializer_list<value_type> initial)</strong>:<br/>
The constructor is initialized with the values stored in the
<em >std::initializer_list</em> of <em >value_type</em> objects. If identical keys
<em >K</em> are used then only the first occurrence of the <em >value_type</em>
object using key <em >K</em> is inserted.
</ul>
<p>
Default and copy constructors are available.
<p>
<h2 >OVERLOADED OPERATORS</h2>
<ul>
<li> <strong >Value &operator[](Key const &key)</strong>:<br/>
A reference to the <em >Value</em> associated with <em >key</em> is returned. If
<em >key</em> was not available prior to the call of the index operator a
<em >value_map(key, Value()) object is inserted.
</em>
<p>
The copy assignment operator is available.
<p>
<h2 >MEMBER FUNCTIONS</h2>
Note that the members of <em >std::vector</em> are not automatically available,
as <strong >LinearMap</strong> is privately inherited from <em >std::vector</em>.
<p>
<strong >LinearMap</strong> offers the following member functions:
<ul>
<li> <strong >Value &at(int idx)</strong>:<br/>
returns a reference to the <strong >LinearMap</strong>'s <em >Value</em> that is associated
with <em >key</em>. If the <em >key</em> is not stored in the <strong >LinearMap</strong> then an
<strong >std::out_of_range</strong> exception is thrown.
<p>
<li> <strong >iterator begin()</strong>:<br/>
returns an iterator pointing to the <strong >LinearMap</strong>'s first element.
<p>
<li> <strong >size_t capacity()</strong>:<br/>
returns the number of elements that can be stored in the <strong >LinearMap</strong>
before its capacity is enlarged.
<p>
<li> <strong >const_iterator cbegin() const</strong>:<br/>
returns a <em >const_iterator</em> pointing to the <strong >LinearMap</strong>'s first
element.
<p>
<li> <strong >const_iterator cend() const</strong>:<br/>
returns a <em >const_iterator</em> pointing beyond the <strong >LinearMap</strong>'s last
element.
<p>
<li> <strong >void clear()</strong>:<br/>
erases all elements from the <strong >LinearMap</strong>.
<p>
<li> <strong >size_t count(key)</strong>:<br/>
returns 1 if the provided key is available in the <strong >LinearMap</strong>, otherwise
0 is returned.
<p>
<li> <strong >const_reverse_iterator crbegin() const</strong>:<br/>
returns a <em >const_reverse_iterator</em> pointing to a <strong >LinearMap</strong> object's
last element.
<p>
<li> <strong >const_reverse_iterator crend() const</strong>:<br/>
returns a <em >const_reverse_iterator</em> pointing before a <strong >LinearMap</strong>
object's first element.
<p>
<li> <strong >std::pair<iterator, bool> emplace(Args &&...args)</strong>:<br/>
a <em >value_type</em> object is constructed from <em >emplace</em>'s arguments. A
<em >std::pair</em> is returned containing an iterator pointing to the object
using that key. If the <strong >LinearMap</strong> already contains an object having
the provided <em >Key</em> value then the returned <em >std::pair's bool</em> value
is <em >false</em>. If the provided <em >key</em> was not found, then the newly
constructed object is inserted into the <strong >LinearMap</strong>, and the returned
<em >std::pair's bool</em> value is <em >true</em>.
<p>
<li> <strong >bool empty()</strong>:<br/>
returns <em >true</em> if the <strong >LinearMap</strong> contains no elements.
<p>
<li> <strong >iterator end()</strong>:<br/>
returns an iterator pointing beyond the <strong >LinearMap</strong>'s last element.
<p>
<li> <strong >std::pair<iterator, iterator> equal_range(key)</strong>:<br/>
returns a pair of iterators, being respectively the return values of the
member functions <em >lower_bound</em> and <em >upper_bound</em>.
<p>
<li> <strong >bool erase(Key const &key)</strong>:<br/>
erases the element having the given <em >key</em> from the
<strong >LinearMap</strong>. <em >True</em> is returned if the value was removed, <em >false</em>
if the <strong >LinearMap</strong> did not contain an element using the given <em >key</em>.
<p>
<li> <strong >void erase(iterator pos)</strong>:<br/>
erases the element at iterator position <em >pos</em>.
<p>
<li> <strong >void erase(iterator begin, iterator end)</strong>:<br/>
erases all elements indicated by the iterator range <em >[first,
beyond)</em>.
<p>
<li> <strong >iterator find(Key const &key)</strong>:<br/>
returns an iterator to the element having the given key. If the element
isn't available, <em >end</em> is returned.
<p>
<li> <strong >const_iterator find(Key const &key) const</strong>:<br/>
returns a <em >const_iterator</em> to the element having the given key. If the
element isn't available, <em >end</em> is returned.
<p>
<li> <strong >allocator_type get_allocator() const</strong>:<br/>
returns a copy of the allocator object used by the <em ><strong >LinearMap</strong></em>
object.
<p>
<li> <strong >std::pair<iterator, bool> insert(value_type const &keyValue)</strong>:<br/>
tries to inserts a new <em >value_type</em> object into the <strong >LinearMap</strong>,
returning a <em >std::pair<iterator, bool></em>. If the returned ti(bool)
field is <em >true</em>, <em >keyValue</em> was inserted into the <strong >LinearMap</strong>. The
value <em >false</em> indicates that the specified key was already available,
and <em >keyvalue</em> was not inserted into the <strong >LinearMap</strong>. In both
cases the <em >iterator</em> field points to the data element having the
specified <em >key</em>.
<p>
<li> <strong >iterator insert(iterator pos, value_type const &keyValue)</strong>:<br/>
tries to insert <em >keyValue</em> into the <strong >LinearMap</strong>. <em >Pos</em> is ignored,
and an iterator to the element having <em >keyValue</em>'s key value is
returned. If the specified key was already present, <em >keyValue</em> is not
inserted into the <strong >LinearMap</strong>.
<p>
<li> <strong >void insert(Iterator begin, Iterator end)</strong>:<br/>
tries to insert the <em >value_type</em> elements pointed at by the iterator
range <em >[begin, end)</em> objects</ul> into the <strong >LinearMap</strong>. <em >Iterator</em>
is any iterator type pointing to <em >value_type</em> objects. Already existing
<em >value_type</em> elements having keys equal to the keys of the elements
pointed at by the iterator range are not replaced.
<p>
<li> <strong >iterator lower_bound(Key const &key)</strong>:<br/>
returns an iterator pointing to the <em >keyvalue</em> element having the
specified <em >key</em>. If no such element exists, <em >end</em> is returned.
<p>
<li> <strong >const_iterator lower_bound(Key const &key) const</strong>:<br/>
returns a <em >const_iterator</em> pointing to the <em >keyvalue</em> element having
the specified <em >key</em>. If no such element exists, <em >end</em> is returned.
<p>
<li> <strong >size_t max_size() const</strong>:<br/>
returns the maximum number of elements this <em ><strong >LinearMap</strong></em> may
contain.
<p>
<li> <strong >reverse_iterator rbegin()</strong>:<br/>
returns a <em >reverse_iterator</em> pointing to the <strong >LinearMap</strong> object's last
element.
<p>
<li> <strong >const_reverse_iterator rbegin() const</strong>:<br/>
returns a <em >const_reverse_iterator</em> pointing to the <strong >LinearMap</strong>
object's last element.
<p>
<li> <strong >reverse_iterator rend()</strong>:<br/>
returns a <em >reverse_iterator</em> pointing before the <strong >LinearMap</strong> object's
first element.
<p>
<li> <strong >const_reverse_iterator rbegin() const</strong>:<br/>
returns a <em >const_reverse_iterator</em> pointing before the <strong >LinearMap</strong>
object's first element.
<p>
<li> <strong >size_t size() const</strong>:<br/>
returns the number of elements in the <strong >LinearMap</strong>.
<p>
<li> <strong >void swap(LinearMap &other)</strong>:<br/>
swaps two <strong >LinearMap</strong>s using identical <em >Key, Value</em> and <em >Alloc</em>
types.
<p>
<li> <strong >iterator upper_bound(Key const &key)</strong>:<br/>
returns an iterator pointing to the <em >keyvalue</em> element having the
specified <em >key</em>. If no such element exists, <em >end</em> is returned.
<p>
<li> <strong >const_iterator upper_bound(Key const &key) const</strong>:<br/>
returns a <em >const_iterator</em> pointing to the <em >keyvalue</em> element having
the specified <em >key</em>. If no such element exists, <em >end</em> is returned.
</ul>
<p>
<h2 >EXAMPLE</h2>
<pre >
#include <iostream>
#include <string>
#include <iostream>
#include <bobcat/linearmap>
using namespace std;
using namespace FBB;
int main()
{
typedef LinearMap<string, string> LM;
// constructors:
LM lm;
LM lm2 =
{
{"one", "value 1"},
{"two", "value 2"}
};
LM lm3(lm2);
LM lm4(lm3.begin(), lm3.end());
// assignment:
lm = lm2;
// some members:
lm["key"] = "value";
cout << lm["key"] << '\n';
cout << lm.find("key")->second << '\n';
for (auto value: lm)
cout << "For loop: " << value.first << ", " <<
value.second << '\n';
cerr << "# times 'key' is stored: " << lm.count("key") << "\n"
"# times 'value is stored: " << lm.count("value") << '\n';
lm4 = lm2;
cout << "lm4's size after assignment: " << lm4.size() << '\n';
lm4.clear();
cout << "lm4's size after clear: " << lm4.size() << '\n';
};
</pre>
<p>
<h2 >FILES</h2>
<em >bobcat/linearmap</em> - defines the class interface
<p>
<h2 >SEE ALSO</h2>
<strong >bobcat</strong>(7)
<p>
<h2 >BUGS</h2>
None Reported.
<p>
<h2 >DISTRIBUTION FILES</h2>
<ul>
<li> <em >bobcat_4.08.02-x.dsc</em>: detached signature;
<li> <em >bobcat_4.08.02-x.tar.gz</em>: source archive;
<li> <em >bobcat_4.08.02-x_i386.changes</em>: change log;
<li> <em >libbobcat1_4.08.02-x_*.deb</em>: debian package holding the
libraries;
<li> <em >libbobcat1-dev_4.08.02-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>
</body>
</html>
|