Why is creating a "std :: regex" Concept Violation?
#define _GLIBCXX_CONCEPT_CHECKS
#include <regex>
void f() { std::regex r("hello"); }
When the above compiles as C ++ 11 in GCC or Clang, a huge template error is generated, the key part of which seems:
/opt/gcc-5.3.0/include/++/5.3.0/bits/boost_concept_check.h: 206: 11: error: using the remote function 'std :: __ detail :: _ StateSeq> & std :: __ detail :: _ StateSeq> :: operator = (const std :: __ detail :: _ StateSeq> &) '
__a = __a; // assignment operator is required
^
But guessing what this means, I notice that std :: regex has an assignment operator .
In addition, I understand that the inclusion of concepts should not change when compiling the code. However, deleting #definedoes compilation.
Question with two parts:
- Is this error and its appearance only with the included concept, the correct behavior?
- If so, how can I create a regex?
GCC 5.4 <regex> , ( make ), , , , AFAICT.
#ifdef _GLIBCXX_CONCEPT_CHECKS
#undef _GLIBCXX_CONCEPT_CHECKS // GCC 5 library bug requires that we disable this for regex
#define NEED_REDEF_OF_GLIBCXX_CONCEPT_CHECKS
#endif
// Standard headers
#include <regex>
#ifdef NEED_REDEF_OF_GLIBCXX_CONCEPT_CHECKS
#define _GLIBCXX_CONCEPT_CHECKS
#endif
// Other headers here