Topic: Defect report [N2134]: regex_token_iterator and const correctness
Author: "=?iso-8859-1?q?Daniel_Kr=FCgler?=" <daniel.kruegler@googlemail.com>
Date: Mon, 5 Mar 2007 13:02:13 CST Raw View
Both the class definition of regex_token_iterator
([re.tokiter]-28.12.2/6)
and the latter member specifications ([re.tokiter.comp]-28.12.2.2/1+2)
declare both comparison operators as non-const functions.
Furtheron, both dereference operators are unexpectedly also
declared as non-const in 28.12.2/6 as well as in
([re.tokiter.deref]-28.12.2.3/1+2).
Proposed resolution:
1) In (28.12.2/6) change the current declarations
bool operator==(const regex_token_iterator&);
bool operator!=(const regex_token_iterator&);
const value_type& operator*();
const value_type* operator->();
to
bool operator==(const regex_token_iterator&) const;
bool operator!=(const regex_token_iterator&) const;
const value_type& operator*() const;
const value_type* operator->() const;
2) In 28.12.2.2 change the following declarations
bool operator==(const regex_token_iterator& right);
bool operator!=(const regex_token_iterator& right);
to
bool operator==(const regex_token_iterator& right) const;
bool operator!=(const regex_token_iterator& right) const;
3) In 28.12.2.3 change the following declarations
const value_type& operator*();
const value_type* operator->();
to
const value_type& operator*() const;
const value_type* operator->() const;
Greetings from Bremen,
Daniel Kr gler
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]