std::showpo...:noshowpoint(3)

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

okay bestie, this is the std::showpo...:noshowpoint(3) page from the C++ Standard Libary manual πŸ’…βœ¨ β€” and yes, we're talking about the twin manipulators for decimal points.

NAME πŸŽ€

std::showpoint,std::noshowpoint - std::showpoint,std::noshowpoint

Synopsis ✨

Defined in header <ios>:

std::ios_base& showpoint( std::ios_base& str );   (1)
std::ios_base& noshowpoint( std::ios_base& str ); (2)

So basically these two enable or disable the unconditional inclusion of the decimal point character in floating-point output. Has no effect on input, periodt.

  1. (1) Enables the showpoint flag in the stream str as if by calling str.setf(std::ios_base::showpoint). Slay.
  2. (2) Disables the showpoint flag in the stream str as if by calling str.unsetf(std::ios_base::showpoint). Iconic.

This is an I/O manipulator, so it may be called with an expression such as out << std::showpoint for any out of type std::basic_ostream, or with an expression such as in >> std::showpoint for any in of type std::basic_istream. Iykyk πŸ¦‹.

The character to use as decimal point character is determined by the numpunct facet of the locale imbued in the stream at the time of output, as described in std::num_put::put. Lowkey important 🌸.

Parameters πŸ’–

  • str β€” reference to I/O stream

Return value 🫢

str (reference to the stream after manipulation).

Example πŸ¦‹

// Run this code

#include <iostream>

int main()
{
    std::cout << "1.0 with showpoint: " << std::showpoint << 1.0 << '\n'
              << "1.0 with noshowpoint: " << std::noshowpoint << 1.0 << '\n';
}

Output πŸ“

1.0 with showpoint: 1.00000
1.0 with noshowpoint: 1

See also 🌈

  • resetiosflags β€” clears the specified ios_base flags (function)
  • setiosflags β€” sets the specified ios_base flags (function)

mwah πŸ’‹ β€” source http://cppreference.com, version/date 2024.06.10, page std::showpo...:noshowpoint(3) πŸ‘‘

πŸ“¦ where this page comes from