std::basic_...ambuf::pbump(3)
π
std::basic_streambuf::pbump π
okay so welcome to the std::basic_...ambuf::pbump(3) page from the C++ Standard Libary manual π β yes, the header really spells it βLibaryβ, and we are keeping that typo because it's iconic. This is your group chat explainer for pbump, with every detail intact and zero boring-manpage energy, no cap. β¨
πΈ NAME πΈ
std::basic_streambuf::pbump - std::basic_streambuf::pbump. That's the name, bestie. It's literally the same thing twice and it's giving main character. π
β¨ Synopsis β¨
protected:
void pbump( int count );
It's protected, so it's not for everyone β main character energy only. π«Ά
So what does it do? It repositions the put pointer (pptr()) by count characters, and count may be positive or negative. No checks are done for moving the pointer outside the put area [pbase(), epptr()) β literally no vibe check. π
β οΈ If the pointer is advanced and thenoverflow()is called to flush the put area to the associated character sequence, the effect is that extracountcharacters with undefined values are output. Undefined values, bestie β not cute. π
π Parameters π
countβ number to add to the put pointer. That's the whole job, slay. π
π Return value π
(none)β literally nothing comes back. The synopsis saysvoid, so it's giving βno return valueβ energy. π¦
π§ Notes π§
Because this function takes an int, it cannot manipulate buffers larger than std::numeric_limits<int>::max() characters (LWG issue 255). Big-buffer girlies, this is your lowkey sad moment. π
π₯ Example π₯
// Run this code
#include <fstream>
#include <iostream>
#include <string>
struct showput_streambuf : std::filebuf
{
using std::filebuf::pbump; // expose protected
std::string showput() const
{
return std::string(pbase(), pptr());
}
};
int main()
{
showput_streambuf mybuf;
mybuf.open("test.txt", std::ios_base::out);
std::ostream str(&mybuf);
str << "This is a test" << std::flush << "1234";
std::cout << "The put area contains: " << mybuf.showput() << '\n';
mybuf.pbump(10);
std::cout << "after pbump(10), it contains " << mybuf.showput() <<
'\n';
}
β Output β
The put area contains: 1234
after pbump(10), it contains 1234 is a test
The output is exactly this, bestie β don't @ me. π
π See also π
gbumpβ advances the next pointer in the input sequence (protected member function). It's the input-side sibling, iykyk, periodt. π
That's the whole page, bestie! Source/version vibe: http://cppreference.com; date: 2024.06.10; footer title: std::basic_...ambuf::pbump(3). Mwah πβ¨ fr fr.
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms