std::char_t...s::compare,(3)

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

πŸ’– NAME πŸ’–

okay so bestie, this is the std::char_t...s::compare,(3) page from the C++ Standard Libary manual β€” yes, β€œLibary,” that’s their spelling, not a typo I’m gonna fix 😭. The whole NAME situation is:

  • std::char_traits::compare,std::char_traits::compare, - std::char_traits::compare,std::char_traits::compare,

and that’s the whole name vibe: std::char_traits::compare, doubled up, iconic, no notes πŸ’…


✨ Synopsis ✨

here’s the exact signature energy, no cap:

                                  std::char_traits<char32_t>::compare

          static int compare( const char_type* s1, const char_type*
          s2,
       (constexpr since C++17)
                              std::size_t count );

so compare is static int compare( const char_type* s1, const char_type* s2, std::size_t count );, and it’s (constexpr since C++17) β€” slay. It compares the first count characters of the character strings s1 and s2. The comparison is done lexicographically. If count is zero, strings are considered equal. See CharTraits for the general requirements on character traits for X::compare.


πŸŽ€ Parameters πŸŽ€

  • s1, s2 β€” pointers to character strings to compare 🫢
  • count β€” the number of characters to compare from each character string

🌸 Return value 🌸

  • Negative value if s1 is less than s2.
  • 0 if s1 is equal to s2.
  • Positive value if s1 is greater than s2.

πŸ¦‹ Complexity πŸ¦‹

Linear in count. fr fr πŸ”₯


xoxo bestie πŸ’‹ β€” source/version: http://cppreference.com, date: 2024.06.10, footer: std::char_t...s::compare,(3).

πŸ“¦ where this page comes from