Mercurial > octave
diff liboctave/util/lo-regexp.h @ 27380:72e8f15b5527
use default copy ctor and assignment op in glob and regexp classes
* glob-match.h (class glob_match): Use default copy constructor and
assignment operators.
* lo-regexp.h (class regexp, class regexp::opts, class
regexp::match_element): Likewise.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 09 Sep 2019 16:24:38 -0400 |
parents | 3db033e86376 |
children | b442ec6dda5c |
line wrap: on
line diff
--- a/liboctave/util/lo-regexp.h Mon Sep 09 16:15:40 2019 -0400 +++ b/liboctave/util/lo-regexp.h Mon Sep 09 16:24:38 2019 -0400 @@ -55,24 +55,9 @@ compile_internal (); } - regexp (const regexp& rx) - : m_pattern (rx.m_pattern), m_data (rx.m_data), m_named_pats (rx.m_named_pats), - m_names (rx.m_names), m_named_idx (rx.m_named_idx) - { } + regexp (const regexp&) = default; - regexp& operator = (const regexp& rx) - { - if (this != &rx) - { - m_pattern = rx.m_pattern; - m_data = rx.m_data; - m_named_pats = rx.m_named_pats; - m_names = rx.m_names; - m_named_idx = rx.m_named_idx; - } - - return *this; - } + regexp& operator = (const regexp& rx) = default; ~regexp (void) { free (); } @@ -143,29 +128,9 @@ m_emptymatch (false), m_freespacing (false), m_lineanchors (false), m_once (false) { } - opts (const opts& o) - : m_case_insensitive (o.m_case_insensitive), - m_dotexceptnewline (o.m_dotexceptnewline), - m_emptymatch (o.m_emptymatch), - m_freespacing (o.m_freespacing), - m_lineanchors (o.m_lineanchors), - m_once (o.m_once) - { } + opts (const opts&) = default; - opts& operator = (const opts& o) - { - if (this != &o) - { - m_case_insensitive = o.m_case_insensitive; - m_dotexceptnewline = o.m_dotexceptnewline; - m_emptymatch = o.m_emptymatch; - m_freespacing = o.m_freespacing; - m_lineanchors = o.m_lineanchors; - m_once = o.m_once; - } - - return *this; - } + opts& operator = (const opts&) = default; ~opts (void) = default; @@ -204,12 +169,9 @@ m_token_extents (te), m_start (s), m_end (e) { } - match_element (const match_element& a) - : m_match_string (a.m_match_string), - m_named_tokens (a.m_named_tokens), m_tokens (a.m_tokens), - m_token_extents (a.m_token_extents), - m_start (a.m_start), m_end (a.m_end) - { } + match_element (const match_element&) = default; + + match_element& operator = (const match_element&) = default; std::string match_string (void) const { return m_match_string; } string_vector named_tokens (void) const { return m_named_tokens; } @@ -240,21 +202,9 @@ : base_list<match_element> (l), m_named_pats (np) { } - match_data (const match_data& rx_lst) - : base_list<match_element> (rx_lst), - m_named_pats (rx_lst.m_named_pats) - { } + match_data (const match_data&) = default; - match_data& operator = (const match_data& rx_lst) - { - if (this != &rx_lst) - { - base_list<match_element>::operator = (rx_lst); - m_named_pats = rx_lst.m_named_pats; - } - - return *this; - } + match_data& operator = (const match_data&) = default; ~match_data (void) = default; @@ -275,7 +225,6 @@ // Internal data describing the regular expression. void *m_data; - std::string m_m; string_vector m_named_pats; int m_names; Array<int> m_named_idx;