|
Boost : |
From: Drazen DOTLIC (Drazen.Dotlic_at_[hidden])
Date: 2003-06-04 07:42:46
Hello,
I am using boost 1_30_0 (NOT current cvs snapshot) and Visual Studio.NET
2003. There is a strange problem with lexical_cast in the following
scenario (rough aproximation of my code, all in one header):
std::ostream& operator<<(std::ostream& out, const ConcreteType& v);
namespace foo
{
namespace bar
{
template <class T> class Formatter
{
public:
std::string getFormattedValue(const T&)
{
return boost::lexical_cast<std::string>(T);
}
}
[,,,]
}
}
When I try to use
Formatter<ConcreteType>::getFormattedValue(objOfConcreteType), the
lexical_cast fails with compiler claiming that there is no operator<<
that accepts const ConcreteType (or no acceptable conversion).
Now, even more funny is that if I put the operator<< in boost namespace,
everything is fine (??). Anyone else seeing this? For the moment I am
assuming this is a compiler bug, but if I missed some dusty (or not so
dusty :) corners of C++ that explain this (in favor of compiler),
someone please enlighten me, this is driving me nuts.
Regards,
Drazen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk