std::basic_ios::fill(3)
β¨ NAME β¨
std::basic_ios::fill β std::basic_ios::fill. okay so bestie, we're on the std::basic_ios::fill(3) page from the C++ Standard Libary, and the NAME section is literally serving the function name twice. iconic.
π Synopsis π
CharT fill() const; (1)
CharT fill( CharT ch ); (2)
Okay so this function manages the fill character used to pad the output conversions to the specified field width. Two overloads, two little moments:
- Returns the current fill character.
- Sets the fill character to
ch, returns previous value of the fill character.
π Parameters π
chβ the character to use as fill character.
π Return value π
The fill character before the call to the function. periodt.
πΈ Example πΈ
// Run this code
#include <iomanip>
#include <iostream>
int main ()
{
std::cout << "With default setting : [" << std::setw(10) << 40 <<
"]\n";
char prev = std::cout.fill('x');
std::cout << "Replaced '" << prev << "' with '"
<< std::cout.fill() << "': [" << std::setw(10) << 40 <<
"]\n";
}
π¦ Output π¦
With default setting : [ 40]
Replaced ' ' with 'x': [xxxxxxxx40]
π₯ See also π₯
setfillβ changes the fill character (function template).
and that's the tea β β this page came from http://cppreference.com, dated 2024.06.10, and it's literally the std::basic_ios::fill(3) footer energy. mwah π
π¦ 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