Boost logo

Boost :

From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2004-03-19 23:17:40


gcc 3.3.3 with boost 1.31.0 on GNU/Linux:

[3/19/2004 Fri 8:16.41 PM stl_at_nuwen ~/boost] [14 33 47]
> cat moo.cc
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main() {
    string s;
    getline(cin, s);
    sregex_token_iterator i(s.begin(), s.end(), regex("\\s+"), -1);

    cout << "x" << *i << "x" << endl;
    ++i;
    cout << "x" << *i << "x" << endl;
    ++i;
    cout << "x" << *i << "x" << endl;
}

[3/19/2004 Fri 8:16.46 PM stl_at_nuwen ~/boost] [14 33 47]
> g++ -Wall -W moo.cc -o moo -lboost_regex

[3/19/2004 Fri 8:16.57 PM stl_at_nuwen ~/boost] [14 33 47]
> moo
1 2 3
x1x
Segmentation fault

[3/19/2004 Fri 8:17.01 PM stl_at_nuwen ~/boost] [14 33 47]
>

However, the first example given in
http://boost.org/libs/regex/doc/regex_token_iterator.html works fine, so I
don't know what's going on.

Stephan T. Lavavej
http://nuwen.net


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk