deductiongu...basic_regex(3)

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

πŸ’– NAME πŸ’–

okay bestie, welcome to the deductiongu...basic_regex(3) page from the C++ Standard Libary β€” yes, that's how it's spelled up top, and we're moving on. The NAME section is serving exactly this:

deductionguidesforstd::basic_regex - deductionguidesforstd::basic_regex

...yes, it says the same thing twice, and honestly? iconic. It's literally the deduction guides for std::basic_regex. πŸ’…

✨ Synopsis ✨

Defined in header <regex> β€” no cap.

template< class ForwardIt >

basic_regex( ForwardIt, ForwardIt,
             std::regex_constants::syntax_option_type =
       (since C++17)
             std::regex_constants::ECMAScript )

-> basic_regex<typename std::iterator_traits<ForwardIt>::value_type>;

This deduction guide is provided for std::basic_regex to allow deduction from an iterator range. That's the whole vibe: iterator range in, basic_regex deduced out, slay. ✨

🌸 Example 🌸

// Run this code

#include <regex>
#include <vector>

int main()
{
    std::vector<char> v = {'a', 'b', 'c'};
    std::basic_regex re(v.begin(), v.end()); // uses explicit deduction guide
}

It's giving tiny main-character demo energy: a std::vector<char> holding {'a', 'b', 'c'}, then std::basic_regex re(v.begin(), v.end()); β€” and the comment is right there saying it uses the explicit deduction guide. Short, sweet, ate. πŸ”₯


Source/version check, bestie: http://cppreference.com Β· 2024.06.10 Β· page deductiongu...basic_regex(3) β€” mwah, bye πŸ«ΆπŸ’–

πŸ“¦ where this page comes from