help with first time boost user

closed account (Dy7SLyTq)
so this is the first time i have used boost, and im getting a bunch of errors. i know it is this function because i compiled before writing it and it went fine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void Lexer::Lex()
{
    string::const_iterator Start = this->Source.begin(),
                           End   = this->Source.end  (); 
    smatch Match;
    match_flag_type Flags = boost::match_default;

    while(regex_search(Start, End, Match, regex("\"[^\"]?\""), Flags))
    {
        this->TokenList.push_back(Token("STRING", this->Source.substr(Match[0].first, Match.size()), 0, Match[0].first));
        Start = Match[0].second;
        Flags |= match_prev_avail;
        Flags |= match_not_bob;
   }
}


here are the errors:
http://pastebin.com/jz3Pwnnf (they are on paste bin because it was too long for c++.com
Can you see if clang gives better diagnostics?
closed account (Dy7SLyTq)
i thought it was old and clunky? and could you give me a download site? ive never used it before
Huh? Haha, clang had better C++11 support than GCC for quite a while, and has always had better diagnostics.

You could maybe get an outdated version with apt-get, but the official downloads page is here:
http://llvm.org/releases/
SVN is currently at 3.4
closed account (Dy7SLyTq)
my bad i was thinking of turbo. ill give it a try. thanks!
closed account (Dy7SLyTq)
http://llvm.org/releases/download.html#3.3 so im going to download and build from source, which of the 3.3 packages do i need?
The getting-started page explains the steps required:
http://clang.llvm.org/get_started.html
It's even possible on Windows (to some extent), though I don't recommend it unless you want to do some crazy stuff.
The type of Match[0].first is an iterator, std::string::substr takes size_t start position and size_t length.
If your Token class takes a std::string as it's second arg maybe you can pass it std::string(Match[0].first, Match[0].second)
Last edited on
closed account (Dy7SLyTq)
ok i changed it to:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void Lexer::Lex()
{
    string::const_iterator Start = this->Source.begin(),
                           End   = this->Source.end  (); 
    smatch Match;
    match_flag_type Flags = match_default;

    while(regex_search(Start, End, Match, regex("\"[^\"]*\""), Flags))
    {
        this->TokenList.push_back(Token("STRING", string(Match[0].first, Match[0].second), 0, -1));
        Start = Match[0].second;
        Flags |= match_prev_avail;
        Flags |= match_not_bob;
   }
}


but got http://pastebin.com/24r3HAEL
Last edited on
closed account (Dy7SLyTq)
@LB: im still building clang so i havent been able to test with it yet
closed account (Dy7SLyTq)
side question: im currently using a vector<Token> for my symbol table. if i turned vector into a linked list would that work better?
What version of boost are you using?
if i turned vector into a linked list would that work better?
Depends on how you are using the container, but for pushing tokens into it shouldn't make much of a difference.
closed account (Dy7SLyTq)
how do i tell what version i have?
http://stackoverflow.com/questions/3708706/how-to-determine-the-boost-version-on-a-system
Our you can look at the libs file name, I believe the version number is part of it.
closed account (Dy7SLyTq)
1.46.1
That's pretty old, that version came out in 2011. Can you upgrade to something more recent?
I don't know if the old version is the issue, but it seems likely to me.
closed account (Dy7SLyTq)
ok ill give it a try. thanks
Topic archived. No new replies allowed.