I can create .o file with g++ -c test.cpp -std=c++0x, but cant link it, got next errors:
test.cpp:(.text+0xe5): undefined reference to `std::regex_iterator<char const*, char, std::regex_traits<char> >::regex_iterator(char const*, char const*, std::basic_regex<char, std::regex_traits<char> > const&, std::bitset<11u>)'
test.cpp:(.text+0xf1): undefined reference to `std::regex_iterator<char const*, char, std::regex_traits<char> >::regex_iterator()'
Code:
#include <regex>
#include <iostream>
#include <string.h>
typedef std::regex_iterator<const char *> Myiter;
int main()
{
const char *pat = "axayaz";
Myiter::regex_type rx("a");
Myiter next(pat, pat + strlen(pat), rx);
Myiter end;
return (0);
}
>classregex_iterator (since C++11) std::regex_iteratoris a read-only iterator that accesses the individual matches of a regular expression within the underlying character sequence. It meets the requirements of a LegacyForwardIterator, except that for dereferenceable values aand bwith a == b, *aand *bwill not be bound to the same object.
regex_iterator () is a function from the BiDirectionalIterator class in C++. This method returns an iterator type to iterate over different matches of a same regex pattern in a sequence. template< class BidirectionalIterator, class CharT = typename std::iterator_traits::value_type, class Traits = std::regex_traits > class regex_iterator
The GNU C++ standard library supports <regex>, but not until version 4.9.0. (The headers were present in earlier versions, but were unusable.) The other compilers don't support it, as far as I can see. You can use a different library if you use an older GCC. Both MSVC and Clang support <regex>.
Conceptually, it holds a regex_iterator object that it uses to search for regular expression matches in a character sequence. It extracts objects of type sub_match<BidIt> representing the submatches identified by the index values in the stored vector subs for each regular expression match.
The GNU C++ standard library supports <regex>
, but not until version 4.9.0. (The headers were present in earlier versions, but were unusable.)
The other compilers don't support it, as far as I can see.
You can use a different library if you use an older GCC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With