std::regex_...:regex_error(3)

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

πŸ’– std::regex_...:regex_error(3) πŸ’–

okay bestie, welcome to the C++ Standard Libary manual page for std::regex_error::regex_error β€” yes, that's the constructor for the regex error class, and it's lowkey the main character of this page. It literally has the same name twice because constructors love that for themselves. πŸ’…


✨ NAME ✨

std::regex_error::regex_error β€” std::regex_error::regex_error

no cap, that's the whole name. it's giving β€œI am my own twin” but make it C++. 🫢


πŸ¦‹ Synopsis πŸ¦‹

okay so it's defined in header <regex>, and both of these constructors have been here since C++11. here's the exact tea:

Defined in header <regex>
regex_error( std::regex_constants::error_type ecode ); (1) (since C++11)
regex_error( const regex_error& other );               (2) (since C++11)
  1. Constructs a regex_error with a given ecode of type std::regex_constants::error_type. literally builds the error object from the code you pass in. πŸ”₯
  2. Copy constructor. Initializes the contents with those of other. and if *this and other both have dynamic type std::regex_error then std::strcmp(what(), other.what()) == 0 β€” yes, that exact check, character for character. πŸ‘‘

🌸 Parameters 🌸

  • ecode β€” error code indicating the error raised in regular expression parsing. it's the little sign that says what went wrong in regex land. πŸ“
  • other β€” another regex_error object to copy. your classic copy-paste bestie. πŸŽ€

πŸ‘‘ See also πŸ‘‘

  • error_type β€” describes different types of matching errors (C++11) (typedef). iconic little typedef behavior, honestly. πŸ’œ

πŸ’– and that's the page, bestie! source: http://cppreference.com, version/date: 2024.06.10, page: std::regex_...:regex_error(3). go forth and construct your regex errors responsibly 🫢✨

πŸ“¦ where this page comes from