Boost logo

Boost Users :

From: Rick Weiss (weissric_at_[hidden])
Date: 2006-11-08 11:24:20


I am trying to use the repeat capture mechanism in regex i thought i
would start with the documentation example, but im having problems
compiling it. Any help is appreciated.

(There is likely a problem between my seat and the keyboard)

Here is my compile output: and below that is the actual example.

  /usr/bin/g++ -Wno-ctor-dtor-privacy -O -o file2AssocTable.o
-I/afs/apd.pok.ibm.com/func/vlsi/eclipz/common/integration/OA_migration/OpenAccess/2.2.4/include/oa
\
 
-I/afs/apd.pok.ibm.com/func/vlsi/eclipz/common/integration/OA_migration/OpenAccess/2.2.4/include
-I/afs/apd.pok.ibm.com/func/vlsi/eclipz/common/integration/GNU/boost/boost_1_33_1/include/boost-1_33_1
\
  -c file2AssocTable.cpp
file2AssocTable.cpp: In function `void print_captures(const
std::string&, const
    std::string&)':
file2AssocTable.cpp:171: no matching function for call to `
    boost::match_results<__gnu_cxx::__normal_iterator<const char*,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
> >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<const
char*,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
> > > >
>::captures(unsigned int&)'
file2AssocTable.cpp:177: no matching function for call to `
    boost::match_results<__gnu_cxx::__normal_iterator<const char*,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
> >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<const
char*,
    std::basic_string<char, std::char_traits<char>, std::allocator<char>
> > > >
>::captures(unsigned int&)'
make: *** [file2AssocTable.o] Error 1

void print_captures(const std::string& regx, const std::string& text)
{
    boost::regex e(regx);
    boost::smatch what;
    std::cout << "Expression: \"" << regx << "\"\n";
    std::cout << "Text: \"" << text << "\"\n";
    if(boost::regex_match(text, what, e, boost::match_extra))
    {
       unsigned i, j;
       std::cout << "** Match found **\n Sub-Expressions:\n";
       for(i = 0; i < what.size(); ++i)
          std::cout << " $" << i << " = \"" << what[i] << "\"\n";
       std::cout << " Captures:\n";
       for(i = 0; i < what.size(); ++i)
       {
          std::cout << " $" << i << " = {";
          for(j = 0; j < what.captures(i).size(); ++j)
          {
             if(j)
                std::cout << ", ";
             else
                std::cout << " ";
             std::cout << "\"" << what.captures(i)[j] << "\"";
          }
          std::cout << " }\n";
       }
    }
    else
    {
       std::cout << "** No Match found **\n";
    }
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net