|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2004-03-02 13:05:14
John Maddock wrote:
> The recent min max changes have caused breakages with vc7.1 + STLPort, the
> problem is that this configuration defines BOOST_NO_STDC_NAMESPACE (because
> STLPort doesn't quite manage to import
> everything into it's "fake" std namespace), which causes the following code:
>
> template< typename T >
> inline T const & std_max( T const & a, T const & b )
> {
> #if defined(__COMO__) || defined(BOOST_INTEL) ||
> defined(BOOST_NO_STD_MIN_MAX)
> using std::max;
> #elif defined(BOOST_NO_STDC_NAMESPACE)
> using ::max; // <- error here
> #else
> using std::max;
> #endif
> return max BOOST_PREVENT_MACRO_SUBSTITUTION ( a, b );
> }
>
> to fail, because min and max *are* in namespace std. Now the thing is,
> BOOST_NO_STDC_NAMESPACE was only really designed to check for C lib
> functions, it was assumed that std lib functions like min and max are always
> in namespace std, are there any situations where that is not the case? If
> not we can just ditch the #elif defined(BOOST_NO_STDC_NAMESPACE) clause
> altogether.
>
Thanks for catching this John. I borrowed this preprocessor logic from
the Interval library. In an earlier discussion, Guillaume suggested I
use it to handle the case where min/max were in the global namespace.
I'm afraid I didn't make myself aware of the details before copying his
code.
Guillaume, what purpose is BOOST_NO_STDC_NAMESPACE serving here?
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk