Boost C++ Libraries: Ticket #63: regex/tokenizer can't be in same file https://svn.boost.org/trac10/ticket/63 <pre class="wiki">I'm trying to use regex and tokenizer in the same file. I'm using MSVC 6.0SP5, boost lib 1.27. When I try to compile, I get the following error: d:\libs\boost\boost\token_functions.hpp(396) : error C2668: 'ispunct' : ambiguous call to overloaded function d:\libs\boost\boost\token_functions.hpp (389) : while compiling class-template member function 'bool __thiscall boost::char_delimiters_separator&lt;char,struct std::char_traits&lt;char&gt; &gt;::is_ret(char) const' Error executing cl.exe. Here is the code: #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;boost/tokenizer.hpp&gt; #include &lt;boost/regex.hpp&gt; using namespace std; using namespace boost; int main(int argc, char* argv[]) { regex re; string s = "This is, a test"; tokenizer&lt;&gt; tok(s); for(tokenizer&lt;&gt;::iterator beg = tok.begin(); beg != tok.end(); ++beg) { cout &lt;&lt; *beg &lt;&lt; "\n"; } return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/63 Trac 1.4.3 kiliman Tue, 19 Feb 2002 22:51:03 GMT <link>https://svn.boost.org/trac10/ticket/63#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/63#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=339840 I'm not sure what is causing the clash between tokenizer and regex, but I've come up with a workaround. I removed the [using namespace std;] statement, and explicitly set namespace on call to ispunct and isspace. bool is_kept(Char E) const { if (m_kept_delims.length()) return m_kept_delims.find(E) != string_type::npos; else if (m_use_ispunct) { //using namespace std; return std::ispunct(E) != 0; } else return false; } bool is_dropped(Char E) const { if (m_dropped_delims.length()) return m_dropped_delims.find(E) != string_type::npos; else if (m_use_isspace) { //using namespace std; return std::isspace(E) != 0; } else return false; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 21 Feb 2002 11:40:34 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/63#comment:2 https://svn.boost.org/trac10/ticket/63#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=14804 Fixed in cvs - I've modified tokenizer so that it uses the same workaround for BOOST_NO_STDC_NAMESPACE that other boost libs use. The workaround suggested is more or less correct (there are a few corner cases it doesn't deal with - but see the cvs version history for details). </pre> Ticket