FBB::Reverse(3bobcat)
π FBB::Reverse π
(straight outta the bobcat manual pages, section 3 β bestie edition)
β¨ NAME β¨
FBB::Reverse β a class template offering reverse iterators. that's it. that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <bobcat/reverse>
β¨ DESCRIPTION β¨
okay so here's the situation. not every data type that offers (or implicitly provides) iterators also offers reverse_iterators. arrays? they don't. π initializer_lists? also no. now, you can use pointers to array elements instead of iterators, but the catch is you literally cannot use arrays in range-based for-loops. tragic.
enter the Ranger class (peep ranger(3bobcat)) β it can be used for defining begin and end members, which lets arrays show up in range-based for-loops. and when you use Reverse objects, your data structures can be used in range-based for-loops and/or to obtain reverse-iterators so you can visit data elements in reversed order. backwards slay. π₯
the class templates Reverse, ReverseArray, and ReverseSize are normally not directly used β instead they're returned by the various reverse support functions. these three classes offer two members: begin, which returns a reverse_iterator to the end of the data range of the object passed to reverse, and end, which returns a reverse_iterator to the beginning of the data range of the object passed to reverse.
β¨ NAMESPACE β¨
FBB
all constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. iykyk. π«Ά
β¨ INHERITS FROM β¨
-
(nothing bestie, it inherits from nothing, main character energy from birth π )
β¨ REVERSE FUNCTIONS β¨
reverse(Type &object)β returns aReverseobject offering reverse iterators to the data range of object, which must supportbeginandendmembers. ifTypeis a constant type, thenReverse'sbeginandendmembers returnconst_reverse_iterators, otherwisereverse_iteratorsare returned.reverse(Type (&array)[size])β returns aReverseobject offering reverse iterators to the reversed range of elements of array. ifTypeis a constant type, thenReverse'sbeginandendmembers returnconst_reverse_iterators, otherwisereverse_iteratorsare returned.reverse(Type *array, size_t size)β returns aReverseobject offering reverse iterators to the reversed range of elements of array to array + size. ifTypeis a constant type, thenReverse'sbeginandendmembers returnconst_reverse_iterators, otherwisereverse_iteratorsare returned.
β¨ EXAMPLE β¨
look at her go π¦
#include <iostream>
#include <vector>
#include <bobcat/reverse>
using namespace std;
using namespace FBB;
int main()
{
int intArr[] = { 1, 2, 3, 4, 5}; // arrays of known sizes
for (int value: reverse(intArr))
cout << value << ' ';
cout << '\n';
for (int value: reverse(intArr, 5)) // using specified sizes
cout << value << ' ';
cout << '\n';
int const constArr[] = { 1, 2, 3, 4, 5};// arrays with const elements
for (int value: reverse(constArr))
cout << value << ' ';
cout << '\n';
for (int value: reverse(constArr, 5)) // using specified sizes
cout << value << ' ';
cout << '\n';
for (int value: reverse(intArr, 5)) // arrays of specified sizes
cout << value << ' ';
cout << '\n';
vector<int> vi{ 1, 2, 3, 4, 5 }; // handle non-const objects
for (int value: reverse(vi))
cout << value << ' ';
cout << '\n';
vector<int> const cvi{ 1, 2, 3, 4, 5 }; // handle const objects
for (int value: reverse(cvi))
cout << value << ' ';
cout << '\n';
// handle lvalues
for (int value: reverse(initializer_list<int>{ 1, 2, 4, 8 }))
cout << value << ' ';
cout.put('\n');
// named constant objects
auto ilist = initializer_list<int>{ 1, 2, 4, 8 };
for (int value: reverse(ilist))
cout << value << ' ';
cout.put('\n');
}
β¨ FILES β¨
bobcat/reverseβ defines the class interfaces and declares thereversefunctions.
β¨ SEE ALSO β¨
β¨ BUGS β¨
None Reported. (not a single one, we're flawless, no cap πβ¨)
β¨ BOBCAT PROJECT FILES β¨
- https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
β¨ BOBCAT β¨
Bobcat is an acronym of Brokken's Own Base Classes And Templates. iconic naming ngl π
β¨ COPYRIGHT β¨
This is free software, distributed under the terms of the GNU General Public License (GPL). π
β¨ AUTHOR β¨
Frank B. Brokken (f.b.brokken@rug.nl).
π and that's a wrap bestie!! this page lives inlibbobcat-dev_6.15.01, dated2005-2026, so if you ever need to cite it or find it again, that's your receipt. go reverse something. periodt. π ππ
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms