Compartir a través de


match_results Class

Holds a sequence of submatches.

template<class BidIt,
    class Alloc = allocator<typename iterator_traits<BidIt>::value_type> >
    class match_results {
public:
    explicit match_results(const Alloc& alloc = Alloc());
    match_results(const match_results& right);

    match_results& operator=(const match_results& right);

    difference_type position(size_type sub = 0) const;
    difference_type length(size_type sub = 0) const;
    string_type str(size_type sub = 0) const;
    const_reference operator[](size_type n) const;

    const_reference prefix() const;
    const_reference suffix() const;
    const_iterator begin() const;
    const_iterator end() const;

    template<class OutIt>
        OutIt format(OutIt out,
            const string_type& fmt, match_flag_type flags = format_default) const;
    string_type format(const string_type& fmt,
        match_flag_type flags = format_default) const;

    allocator_type get_allocator() const;
    void swap(const match_results& other) throw();

    size_type size() const;
    size_type max_size() const;
    bool empty() const;

    typedef sub_match<BidIt> value_type;
    typedef const typename Alloc::const_reference const_reference;
    typedef const_reference reference;
    typedef T0 const_iterator;
    typedef const_iterator iterator;
    typedef typename iterator_traits<BidIt>::difference_type difference_type;
    typedef typename Alloc::size_type size_type;
    typedef Alloc allocator_type;
    typedef typename iterator_traits<BidIt>::value_type char_type;
    typedef basic_string<char_type> string_type;
    };

Parameters

  • BidIt
    The iterator type for submatches.

  • Alloc
    The type of an allocator for managing storage.

Remarks

The template class describes an object that controls a non-modifiable sequence of elements of type sub_match<BidIt> generated by a regular expression search. Each element points to the subsequence that matched the capture group corresponding to that element.

Requirements

Header: <regex>

Namespace: std

See Also

Reference

<regex>

Other Resources

<regex> Members