This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Compare two regular expressions -> check if empty()


Hi,

when I read the regular expression section in C++11 correctly, there's
no method called "size", "length" in order to get the length of a
regular expression or a method "empty(). Using Boost's regex
implementation e.g. provides empty(). So I need to do a comparison of
two regexes - consider the following code:

#include <regex>
#include <iostream>

int main()
{
  std::regex test("");

  std::regex test2("");

  if (test == test2) {
    std::cout << "empty" << std::endl;
  }

  return 0;
}

Won't compile with the latest GCC 5.

As I read the current regex implementation, there's an internal variable
called "_M_original_str". So maybe it would be a good idea to compare
lhs and rhs of two regexes for the == operator in order to get the
comparison mentioned above work?

Thanks in advance + regards,

Stefan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]