Boost logo

Boost Users :

From: Carl Waldbieser (yg-boost-users_at_[hidden])
Date: 2003-07-23 00:20:55


I get the following compilation error for this simple program under MSVC6:

************** test.cpp******************
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"

int main()
{
using namespace std;

cout << ispunct(',') << endl;

return 0;
}

************************************

error:
--------------------Configuration: names_test - Win32
Debug--------------------
Compiling...
test.cpp
c:\documents and settings\waldbcar.waldbcar\my documents\my
projects\vc\test\names_test\test.cpp(8) : error C2668: 'ispunct' :
ambiguous call to overloaded function
Error executing cl.exe.

test.obj - 1 error(s), 0 warning(s)

Normally, this sort of thing would not be a problem, as I typically would
just be using the qualified std::ispunct() instead of a using directive.
However, this problem cropped up when I was trying to use the date-time
library in conjuction with the Spirit parsing library. Spirit implements
some function by doing exactly what I did in the above sample-- using a
using directive and then calling ispunct() unqualified. I am guessing the
ratonale behind this might have something to do with the fact that under
MSVC6, functions like ispunct() (and most or all of <ccytpe>) seem to have
been dumped into the global namespace by default. However, it seems like
the date-time library must be doing something like:

namespace std
{
    using ::ispunct;
}

somewhere in its internals (or maybe just using something else that does?).
Anyway, it seems to be a shame that I can't get these two great libraries to
work together on my compiler. Is there any chance that someone out there
might have a solution?

Carl Waldbieser
waldbie<at-sign>attglobal.net


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