Topic: Defect Report: Operator functions impossible to compare are defined


Author: nzm-mm@tsuki.jpn.org (Nozomu Katoo)
Date: Sun, 27 May 2007 17:02:10 GMT
Raw View
Dear C++ committee,

In "28.9.2 sub_match non-member operators [re.submatch.op]" of N2284,
operator functions numbered 31-42 seem impossible to compare.  E.g.:

  template <class BiIter>
    bool operator==(typename iterator_traits<BiIter>::value_type const& lhs,
                    const sub_match<BiIter>& rhs);

  31 Returns: lhs == rhs.str().

When char* is used as BiIter, iterator_traits<BiIter>::value_type would be
char, so that lhs == rhs.str() ends up comparing a char value and an object
of std::basic_string<char>.  However, the behaviour of comparison between
these two types is not defined in "21.3.8 basic_string non-member functions
[string.nonmembers]" of N2284.  This applies when wchar_t* is used as BiIter.

Sincerely,

--
Nozomu Katoo <nzm-mm@tsuki.jpn.org>

---
[ 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                      ]