std::basic_ios::fill(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ 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:

  1. Returns the current fill character.
  2. 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