std::gslice(3)
π std::gslice π
okay bestie, welcome to the Library Functions Manual entry for std::gslice β she's a whole vibe and she's about to teach you how to carve a multi-dimensional subset out of an array. no cap. π¦
β¨ NAME β¨
std::gslice β Class defining multi-dimensional subset of an array.
like, imagine a regular slice but make it dimensional. she's giving main character energy fr fr. π
β¨ SYNOPSIS β¨
#include <valarray>
πΈ Public Member Functions πΈ
gslice ()β Construct an empty slice. (yes, an empty one. she exists but she's got nothing going on. still iconic tho π )gslice (const gslice &)β Copy constructor. clone her, she doesn't mind π«Άgslice (size_t __o, const valarray< size_t > &__l, const valarray< size_t > &__s)β Construct a slice. this is the one, this is the moment β¨~gslice ()β Destructor. she's done, she's leaving, no drama πgslice & operator= (const gslice &)β Assignment operator. you become her, she becomes you, it's a whole thing πvalarray< size_t > size () constβ Return array of sizes of slice dimensions.size_t start () constβ Return array offset of first slice element.valarray< size_t > stride () constβ Return array of array strides for each dimension.
π§ Friends π§
template<typename _Tp> class valarray
aww look at them, they're friends π₯Ή the valarray class gets to hang out in here.
β¨ Detailed Description β¨
Class defining multi-dimensional subset of an array.
so here's the tea β the slice class represents a multi-dimensional subset of an array, and it's specified by three parameter sets, bestie:
- start offset
- size array
- stride array
the start offset is the index of the first element of the array that is part of the subset. periodt. π
the size and stride array describe each dimension of the slice:
- Size is the number of elements in that dimension.
- stride is the distance in the array between successive elements in that dimension.
each dimension's size and stride is taken to begin at an array element described by the previous dimension. π₯ and β super important, don't skip this β the size array and stride array must be the same size. they're a matched set, they're soulmates, don't split them up π
okay so for example, if you have:
offset==3, stride[0]==11, size[1]==3, stride[1]==3
then:
slice[0,0]==array[3], slice[0,1]==array[6], slice[0,2]==array[9],
slice[1,0]==array[14], slice[1,1]==array[17], slice[1,2]==array[20]
the way those indices just land perfectly?? ate. no crumbs. πβ¨
β¨ Author β¨
Generated automatically by Doxygen for libstdc++ from the source code.
(not me being jealous of an auto-generated author credit π)
and that's the whole page bestie!! π she's part of libstdc++, she's a Library Functions Manual girlie, and yes β std::gslice(3) is literally the name at the top and the bottom because that's just how manpages do. obsessed with the symmetry ngl. πΈπ¦π
π¦ 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 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