SGIextensions(3)

✨ NAME ✨

Okay so bestie, this is literally SGIextensions(3) from the Library Functions Manual β€” and it's giving SGI energy. The name is SGIextensions - SGI. No cap. πŸ’…


🌸 SYNOPSIS 🌸

πŸŽ€ Classes

Here's the whole class lineup, and yes every single one is included. Periodt. πŸ’–

  • class __gnu_cxx::binary_compose< _Operation1, _Operation2, _Operation3 > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::constant_binary_fun< _Result, _Arg1, _Arg2 > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::constant_unary_fun< _Result, _Argument > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::constant_void_fun< _Result > β€” An SGI extension . πŸ’…
  • class __gnu_cxx::hash_map< _Key, _Tp, _HashFn, _EqualKey, _Alloc >
  • class __gnu_cxx::hash_multimap< _Key, _Tp, _HashFn, _EqualKey, _Alloc >
  • class __gnu_cxx::hash_multiset< _Value, _HashFcn, _EqualKey, _Alloc >
  • class __gnu_cxx::hash_set< _Value, _HashFcn, _EqualKey, _Alloc >
  • struct __gnu_cxx::project1st< _Arg1, _Arg2 > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::project2nd< _Arg1, _Arg2 > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::rb_tree< _Key, _Value, _KeyOfValue, _Compare, _Alloc >
  • class __gnu_cxx::rope< _CharT, _Alloc >
  • struct __gnu_cxx::select1st< _Pair > β€” An SGI extension . πŸ’…
  • struct __gnu_cxx::select2nd< _Pair > β€” An SGI extension . πŸ’…
  • class __gnu_cxx::slist< _Tp, _Alloc >
  • class __gnu_cxx::subtractive_rng
  • struct __gnu_cxx::temporary_buffer< _ForwardIterator, _Tp >
  • class __gnu_cxx::unary_compose< _Operation1, _Operation2 > β€” An SGI extension . πŸ’…

πŸ¦‹ Functions

Okay so here are all the functions, fr fr. Each signature is copied exactly, so don't come for me. 😭

template<typename _Tp> const _Tp & __gnu_cxx::__median (const _Tp &__a,
    const _Tp &__b, const _Tp &__c)

Find the median of three values. πŸ’…

template<typename _Tp, typename _Compare> const _Tp &
__gnu_cxx::__median (const _Tp &__a, const _Tp &__b, const _Tp &__c,
    _Compare __comp)

Find the median of three values using a predicate for comparison. ✨

constexpr size_t std::bitset< _Nb >::_Find_first () const noexcept

Finds the index of the first on"bit. 🌸

constexpr size_t std::bitset< _Nb >::_Find_next (size_t __prev) const
    noexcept

Finds the index of the next on"bitafterprev. 🌸

template<class _Operation1, class _Operation2> unary_compose<
    _Operation1, _Operation2 > __gnu_cxx::compose1 (const _Operation1
    &__fn1, const _Operation2 &__fn2)

An SGI extension . πŸ’…

template<class _Operation1, class _Operation2, class _Operation3>
    binary_compose< _Operation1, _Operation2, _Operation3 >
    __gnu_cxx::compose2 (const _Operation1 &__fn1, const _Operation2
    &__fn2, const _Operation3 &__fn3)

An SGI extension . πŸ’…

template<class _Result> constant_void_fun< _Result >
    __gnu_cxx::constant0 (const _Result &__val)

An SGI extension . πŸ’…

template<class _Result> constant_unary_fun< _Result, _Result >
    __gnu_cxx::constant1 (const _Result &__val)

An SGI extension . πŸ’…

template<class _Result> constant_binary_fun< _Result, _Result, _Result >
    __gnu_cxx::constant2 (const _Result &__val)

An SGI extension . πŸ’…

template<typename _InputIterator, typename _Size, typename
    _OutputIterator> std::pair< _InputIterator, _OutputIterator >
    __gnu_cxx::copy_n (_InputIterator __first, _Size __count,
    _OutputIterator __result)

Copies the range [first,first+count) into [result,result+count). 🫢

template<typename _InputIterator, typename _Distance> void
    __gnu_cxx::distance (_InputIterator __first, _InputIterator __last,
    _Distance &__n)
template<class _Tp> _Tp __gnu_cxx::identity_element (std::multiplies<
    _Tp >)

An SGI extension . πŸ’…

template<class _Tp> _Tp __gnu_cxx::identity_element (std::plus< _Tp >)

An SGI extension . πŸ’…

template<typename _InputIterator1, typename _InputIterator2> int
    __gnu_cxx::lexicographical_compare_3way (_InputIterator1 __first1,
    _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2
    __last2)

memcmp on steroids. πŸ”₯

template<typename _Tp, typename _Integer> _Tp __gnu_cxx::power (_Tp __x,
    _Integer __n)
template<typename _Tp, typename _Integer, typename _MonoidOperation> _Tp
    __gnu_cxx::power (_Tp __x, _Integer __n, _MonoidOperation
    __monoid_op)
template<typename _InputIterator, typename _RandomAccessIterator>
    _RandomAccessIterator __gnu_cxx::random_sample (_InputIterator
    __first, _InputIterator __last, _RandomAccessIterator __out_first,
    _RandomAccessIterator __out_last)
template<typename _InputIterator, typename _RandomAccessIterator,
    typename _RandomNumberGenerator> _RandomAccessIterator
    __gnu_cxx::random_sample (_InputIterator __first, _InputIterator
    __last, _RandomAccessIterator __out_first, _RandomAccessIterator
    __out_last, _RandomNumberGenerator &__rand)
template<typename _ForwardIterator, typename _OutputIterator, typename
    _Distance> _OutputIterator __gnu_cxx::random_sample_n
    (_ForwardIterator __first, _ForwardIterator __last, _OutputIterator
    __out, const _Distance __n)
template<typename _ForwardIterator, typename _OutputIterator, typename
    _Distance, typename _RandomNumberGenerator> _OutputIterator
    __gnu_cxx::random_sample_n (_ForwardIterator __first,
    _ForwardIterator __last, _OutputIterator __out, const _Distance __n,
    _RandomNumberGenerator &__rand)
template<typename _InputIter, typename _Size, typename _ForwardIter>
    std::pair< _InputIter, _ForwardIter >
    __gnu_cxx::uninitialized_copy_n (_InputIter __first, _Size __count,
    _ForwardIter __result)

Copies the range [first,last) into result. 🫢

constexpr bitset< _Nb > & std::bitset< _Nb >::_Unchecked_set (size_t
    __pos) noexcept
constexpr bitset< _Nb > & std::bitset< _Nb >::_Unchecked_set (size_t
    __pos, int __val) noexcept
constexpr bitset< _Nb > & std::bitset< _Nb >::_Unchecked_reset (size_t
    __pos) noexcept
constexpr bitset< _Nb > & std::bitset< _Nb >::_Unchecked_flip (size_t
    __pos) noexcept
constexpr bool std::bitset< _Nb >::_Unchecked_test (size_t __pos) const
    noexcept

πŸ”₯ Detailed Description πŸ”₯

Okay so the tea: because libstdc++ based its implementation of the STL subsections of the library on the SGI 3.3 implementation, we inherited their extensions as well. No cap. πŸ’…

They are additionally documented in the online documentation, a copy of which is also shipped with the library source code (in .../docs/html/documentation.html). You can also read the documentation on SGI's site, which is still running even though the code is not maintained. Iconic, honestly. 🫢

NB that the following notes are pulled from various comments all over the place, so they may seem stilted. Lowkey a mood. 😭

The identity_element functions are not part of the C++ standard; SGI provided them as an extension. Its argument is an operation, and its return value is the identity element for that operation. It is overloaded for addition and multiplication, and you can overload it for your own nefarious operations. Slay. πŸ‘‘

As an extension to the binders, SGI provided composition functors and wrapper functions to aid in their creation. The unary_compose functor is constructed from two functions/functors, f and g. Calling operator() with a single argument x returns f(g(x)). The function compose1 takes the two functions and constructs a unary_compose variable for you. It's giving math but make it functor. ✨

binary_compose is constructed from three functors, f, g1, and g2. Its operator() returns f(g1(x),g2(x)). The function compose2 takes f, g1, and g2, and constructs the binary_compose instance for you. For example, if f returns an int, then

int answer = (compose2(f,g1,g2))(x);

is equivalent to

int temp1 = g1(x);
int temp2 = g2(x);
int answer = f(temp1,temp2);

But the first form is more compact, and can be passed around as a functor to other algorithms. Periodt. πŸ’…

As an extension, SGI provided a functor called identity. When a functor is required but no operations are desired, this can be used as a pass-through. Its operator() returns its argument unchanged. No thoughts, just vibes. πŸ¦‹

select1st and select2nd are extensions provided by SGI. Their operator()s take a std::pair as an argument, and return either the first member or the second member, respectively. They can be used (especially with the composition functors) to strip data from a sequence before performing the remainder of an algorithm. Obsessed. πŸ’–

The operator() of the project1st functor takes two arbitrary arguments and returns the first one, while project2nd returns the second one. They are extensions provided by SGI. Main character energy for real. πŸ‘‘

These three functors are each constructed from a single arbitrary variable/value. Later, their operator()s completely ignore any arguments passed, and return the stored value.

  • constant_void_fun's operator() takes no arguments
  • constant_unary_fun's operator() takes one argument (ignored)
  • constant_binary_fun's operator() takes two arguments (ignored)

The helper creator functions constant0, constant1, and constant2 each take a result argument and construct variables of the appropriate functor type. Fr fr. 🫢

✨ Function Documentation ✨

okay bestie, this is where the magic happens. all the SGI extension functions, laid out like a group chat. let's go πŸ’…


template<typename _Tp> const _Tp & __gnu_cxx::__median (const _Tp & __a, const _Tp & __b, const _Tp & __c)

find the median of three values. πŸ’–

Parameters:

  • __a β€” a value.
  • __b β€” a value.
  • __c β€” a value.

Returns: one of a, b or c.

if {l,m,n} is some convolution of {a,b,c} such that l<=m<=n then the value returned will be m. this is an SGI extension. no cap.


template<typename _Tp, typename _Compare> const _Tp & __gnu_cxx::__median (const _Tp & __a, const _Tp & __b, const _Tp & __c, _Compare __comp)

find the median of three values using a predicate for comparison. ✨

Parameters:

  • __a β€” a value.
  • __b β€” a value.
  • __c β€” a value.
  • __comp β€” a binary predicate.

Returns: one of a, b or c.

if {l,m,n} is some convolution of {a,b,c} such that comp(l,m) and comp(m,n) are both true then the value returned will be m. this is an SGI extension. periodt.


template<size_t _Nb> size_t std::bitset< _Nb >::_Find_first () const

[inline], [constexpr], [noexcept] β€” finds the index of the first "on" bit. πŸ¦‹

Returns: the index of the first bit set, or size() if not found.

See also: _Find_next


template<size_t _Nb> size_t std::bitset< _Nb >::_Find_next (size_t __prev) const

[inline], [constexpr], [noexcept] β€” finds the index of the next "on" bit after prev. 🌸

Returns: the index of the next bit set, or size() if not found.

Parameters:

  • __prev β€” where to start searching.

See also: _Find_first


template<size_t _Nb> bitset< _Nb > & std::bitset< _Nb >::_Unchecked_flip (size_t __pos)

[inline], [constexpr], [noexcept] β€” these versions of single-bit set, reset, flip, and test are extensions from the SGI version. they do no range checking. πŸ’€

referenced by flip().


template<size_t _Nb> bitset< _Nb > & std::bitset< _Nb >::_Unchecked_reset (size_t __pos)

[inline], [constexpr], [noexcept] β€” these versions of single-bit set, reset, flip, and test are extensions from the SGI version. they do no range checking. πŸ’€

referenced by reset().


template<size_t _Nb> bitset< _Nb > & std::bitset< _Nb >::_Unchecked_set (size_t __pos)

[inline], [constexpr], [noexcept] β€” these versions of single-bit set, reset, flip, and test are extensions from the SGI version. they do no range checking. πŸ’€

referenced by set().


template<size_t _Nb> bitset< _Nb > & std::bitset< _Nb >::_Unchecked_set (size_t __pos, int __val)

[inline], [constexpr], [noexcept] β€” these versions of single-bit set, reset, flip, and test are extensions from the SGI version. they do no range checking. πŸ’€


template<size_t _Nb> bool std::bitset< _Nb >::_Unchecked_test (size_t __pos) const

[inline], [constexpr], [noexcept] β€” these versions of single-bit set, reset, flip, and test are extensions from the SGI version. they do no range checking. πŸ’€

referenced by operator[](), and test().


template<class _Operation1, class _Operation2> unary_compose< _Operation1, _Operation2 > __gnu_cxx::compose1 (const _Operation1 & __fn1, const _Operation2 & __fn2)

[inline] β€” an SGI extension . ✨


template<class _Operation1, class _Operation2, class _Operation3> binary_compose< _Operation1, _Operation2, _Operation3 > __gnu_cxx::compose2 (const _Operation1 & __fn1, const _Operation2 & __fn2, const _Operation3 & __fn3)

[inline] β€” an SGI extension . ✨


template<class _Result> constant_void_fun< _Result > __gnu_cxx::constant0 (const _Result & __val)

[inline] β€” an SGI extension . ✨


template<class _Result> constant_unary_fun< _Result, _Result > __gnu_cxx::constant1 (const _Result & __val)

[inline] β€” an SGI extension . ✨


template<class _Result> constant_binary_fun< _Result, _Result, _Result > __gnu_cxx::constant2 (const _Result & __val)

[inline] β€” an SGI extension . ✨


template<typename _InputIterator, typename _Size, typename _OutputIterator> std::pair< _InputIterator, _OutputIterator > __gnu_cxx::copy_n (_InputIterator __first, _Size __count, _OutputIterator __result)

[inline] β€” copies the range [first,first+count) into [result,result+count). πŸ’–

Parameters:

  • __first β€” an input iterator.
  • __count β€” the number of elements to copy.
  • __result β€” an output iterator.

Returns: a std::pair composed of first+count and result+count.

this is an SGI extension. this inline function will boil down to a call to memmove whenever possible. failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). πŸ”₯

References: std::__iterator_category().


template<typename _InputIterator, typename _Distance> void __gnu_cxx::distance (_InputIterator __first, _InputIterator __last, _Distance & __n)

[inline] β€” this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭

References: std::__iterator_category(), and distance().

Referenced by: __gnu_cxx::temporary_buffer< _ForwardIterator, _Tp >::temporary_buffer(), and distance().


template<class _Tp> _Tp __gnu_cxx::identity_element (std::multiplies< _Tp > )

[inline] β€” an SGI extension . ✨


template<class _Tp> _Tp __gnu_cxx::identity_element (std::plus< _Tp > )

[inline] β€” an SGI extension . ✨


template<typename _InputIterator1, typename _InputIterator2> int __gnu_cxx::lexicographical_compare_3way (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)

memcmp on steroids. πŸ’€πŸ”₯

Parameters:

  • __first1 β€” an input iterator.
  • __last1 β€” an input iterator.
  • __first2 β€” an input iterator.
  • __last2 β€” an input iterator.

Returns: an int, as with memcmp.

the return value will be less than zero if the first range is lexigraphically less than the second, greater than zero if the second range is lexigraphically less than the first, and zero otherwise. this is an SGI extension. periodt.


template<typename _Tp, typename _Integer> _Tp __gnu_cxx::power (_Tp __x, _Integer __n)

[inline] β€” this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭


template<typename _Tp, typename _Integer, typename _MonoidOperation> _Tp __gnu_cxx::power (_Tp __x, _Integer __n, _MonoidOperation __monoid_op)

[inline] β€” this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭


template<typename _InputIterator, typename _RandomAccessIterator> _RandomAccessIterator __gnu_cxx::random_sample (_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out_first, _RandomAccessIterator __out_last)

[inline] β€” this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭


template<typename _InputIterator, typename _RandomAccessIterator, typename _RandomNumberGenerator> _RandomAccessIterator __gnu_cxx::random_sample (_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out_first, _RandomAccessIterator __out_last, _RandomNumberGenerator & __rand)

[inline] β€” this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭


template<typename _ForwardIterator, typename _OutputIterator, typename _Distance> _OutputIterator __gnu_cxx::random_sample_n (_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __out, const _Distance __n)

this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭

References: std::distance(), std::min(), and random_sample_n().

Referenced by: random_sample_n().


template<typename _ForwardIterator, typename _OutputIterator, typename _Distance, typename _RandomNumberGenerator> _OutputIterator __gnu_cxx::random_sample_n (_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __out, const _Distance __n, _RandomNumberGenerator & __rand)

this is an SGI extension. πŸ¦‹

Todo: needs documentation! see http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html 😭

References: std::distance(), and std::min().


template<typename _InputIter, typename _Size, typename _ForwardIter> std::pair< _InputIter, _ForwardIter > __gnu_cxx::uninitialized_copy_n (_InputIter __first, _Size __count, _ForwardIter __result)

[inline] β€” copies the range [first,last) into result. πŸ’–

Parameters:

  • __first β€” an input iterator.
  • __count β€” Length
  • __result β€” an output iterator.

Returns: __result + (__first + __count)

like copy(), but does not require an initialized output range.

References: std::__iterator_category().


πŸ‘‘ Author πŸ‘‘

generated automatically by Doxygen for libstdc++ from the source code. πŸ’…


and that's the whole vibe, bestie! this page came from libstdc++ and it's the SGIextensions(3) manual. slay. 🫢✨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 43: libstdc++-docs 15.2.1-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 43: libstdc++-docs 15.3.1-1.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms